convert string type to object javascript code example
Example 1: convert string to object javascript
var mystr = '{ "hello":"world" }' // NB: Has enclosing ""
var myobj = JSON.parse(mystr);
Example 2: javascript type casting int
Number("3.14") // returns 3.14
false.toString() // returns "false"
String(false) // returns "false"