javascript - Function bringing back error 'token {'? -
i'm new javascript , i'm having hard time functions. tried this:
(function data { // part that's broken seems? var data = 1; var real = 2; console.log(data + real) // })
i error: uncaught syntaxerror: unexpected token {
i'm not sure means though?
seems me, bit confused brackets... try this:
function data(){ var data = 1; var real = 2; console.log(data+real); }
the error suggests there problem token didn't expect there...
hope helps!
Comments
Post a Comment