回答編集履歴
1
調整
test
CHANGED
@@ -1,2 +1,28 @@
|
|
1
1
|
状況がわかりませんがとりあえずtry-catchしてみるとかですかね
|
2
2
|
- [try...catch - JavaScript | MDN](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Statements/try...catch)
|
3
|
+
|
4
|
+
```javascript
|
5
|
+
<script>
|
6
|
+
try{
|
7
|
+
hoge('apple');
|
8
|
+
}catch(e){
|
9
|
+
console.error(e);
|
10
|
+
}
|
11
|
+
try{
|
12
|
+
if(typeof hoge=="undefined"){
|
13
|
+
throw new Error("my error!");
|
14
|
+
}
|
15
|
+
hoge('apple');
|
16
|
+
}catch(e){
|
17
|
+
console.error(e);
|
18
|
+
}
|
19
|
+
</script>
|
20
|
+
<script src="https://example.com/hoge.js"></script>
|
21
|
+
<script>
|
22
|
+
try{
|
23
|
+
hoge('apple');
|
24
|
+
}catch(e){
|
25
|
+
console.error(e);
|
26
|
+
}
|
27
|
+
</script>
|
28
|
+
```
|