简体   繁体   中英

Unexpected Number 'var' JS node.js

Ok so, I am a total noob at node.js,and have a little experience with js,and this could be a simple answer but I've been surfing around,and could not find the solution. Here is my code.

var number = []
io.sockets.on('connection', function (socket) {
socket.on("start", function(){
    currand = random()
    number.push(currand)
    idco = number.length - 1
    io.emit("rcb",{rcbo: currand,idc:idco}
});      

The function random just returns a random number. When I try to run this , it does not work,and cmd gives me this error Syntax Error: Unexpected Number. Thanks in advance.

好的,我知道我做错了什么,实数变量名中有一个数字,这使它不起作用,感谢您的时间。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM