uncaught syntaxerror unexpected token U JSON

uncaught syntaxerror unexpected token U JSON

The parameter for the JSON.parse may be returning nothing (i.e. the value given for the JSON.parse is undefined)!

It happened to me while I was parsing the Compiled solidity code from an xyz.sol file.

import web3 from './web3';
import xyz from './build/xyz.json'; const i = new web3.eth.Contract(
JSON.parse(xyz.interface),
'0x99Fd6eFd4257645a34093E657f69150FEFf7CdF5'
); export default i;

which was misspelled as

JSON.parse(xyz.intereface)

which was returning nothing!

看了一下本地的代码,传递给函数的参数是$('#ctl00_cphMain_ucProfile_Avatar_hffulList').val(),

在Chrome的console的控制台运行,发现返回结果是undefined,

在html里面搜索了一下ctl00_cphMain_ucProfile_Avatar_hffulList,发现这个元素不存在

上一篇:Atitit  Uncaught (in promise) SyntaxError Unexpected token < in JSON at position 0


下一篇:Java的Guava