Built-in objects

eval(string)

let x = 1
let y = 1

console.log(eval('x+y+1'));        //3

parseInt(string, radix)

console.log(parseInt('10'))            //10
console.log(parseInt('F',16))          //15
console.log(parseInt('15', 10))        //15
console.log(parseInt('Hi', 10))        //NaN

parseFloat(string)

console.log(parseFloat('3.99'));        //3.99
console.log(parseFloat('3.99e-1'));     //0.399
console.log(parseFloat(''));            //NaN

escape(string)

console.log(escape('text'))        //text
console.log(escape(' '))           //%20
console.log(escape('abc&%'))       //abc%26%25

unescape(string)

console.log(unescape('%20'))         //
console.log(unescape('abc%26%25'))   //abc&%

Last updated