javascript - Can't pass time as argument to function -


i need pass time in colon format argument

var carslider = new slider(     'car_slider',     {         minval:   "11:30",         maxval:   500,         onchange: function() { console.log(arguments); }     } ); 

i using above code pass

but shows following error

syntaxerror: missing } after property list

...ider('bus_depart_slider',{minval:11:30,maxval:500,onchange: function() {console.... 

the error message says all, albeit error messages half battle deciphering means!

syntaxerror: missing } after property list

when refers "property list" means object literal property list list of properties contained in object literal

var myobjliteral = {       prop: "foo" }; 

in above code if omitted closing } above error

var myobjliteral = {       prop: "foo"  // error here - syntaxerror: missing } after property list  var nextline = "bar" 

now, reference code, passing 2 parameters slider - first string, second object literal:

var carslider = new slider(     'car_slider', // argument 1 (string)     {         minval:   "11:30",         maxval:   500,         onchange: function() { console.log(arguments); }     } // argument 2 (object literal) ); 

if omit closing braces, see error described

var carslider = new slider(     'car_slider',      {         minval:   "11:30",         maxval:   500,         onchange: function() { console.log(arguments); }      // syntaxerror: missing } after property list          ); 

another way error message passing string variable without wrapping in quotes - javascript interpreter try parse intended string instead variable or function declaration - end result thinks you've forgotten closing } per above example.

var carslider = new slider(     'car_slider',      {         minval:   11:30, // <-- here         maxval:   500,         onchange: function() { console.log(arguments); }     }  ); 

in above example, instead of passing string "11:30" ive forgotten quotes. javascript try evaluate 11:30 if declaration. : has specific meaning in javascript syntax (as part of ternary operator) yet rest of not make sense in context placed.

im not sure of these 2 mistakes you've made, 1 of them cause.


Comments