本文介紹了Uncaught SyntaxError: Unexpected token = in Google Chrome的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我有一個接受可選參數的 javascript 函數.這在 Firefox
中運行良好,但在 Google Chrome
中顯示:-
I have a javascript function which accept an optional parameter. This works fine in Firefox
, but in Google Chrome
it shows:-
Uncaught SyntaxError: Unexpected token =
我的代碼,
function errorNotification(text = "Something went wrong!") {
$.pnotify({
title: 'Error',
text: text,
type: 'error'
});
}
我見過很多類似的問題,但我無法意識到我的問題.
I have seen lot of similar questions but I can't realize my problem.
推薦答案
您使用的是 默認參數 特性,現在只有 Firefox 支持.
You are using a default parameter feature which is supported only by Firefox now.
function errorNotification(text) {
text = text || "Something went wrong!";
$.pnotify({
title: 'Error',
text: text,
type: 'error'
});
}
這篇關于Uncaught SyntaxError: Unexpected token = in Google Chrome的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!