Простые типы / Строки

//to int
let strNumber = "42"
//the first method
let number = Number(strNumber)
//the second method
number = parseInt(strNumber)

//to Double and Float
//the first method
let strPi = "3.14"
let pi = parseFloat(strPi)

//the second method
let strExp = "2.71828"
let exp = +strExp

//the third method
let strHalf = "0,5"
let half = +strHalf.replace(","".")

console.log("number ="number)
console.log("pi =", pi)
console.log("exp =", exp)
console.log("half =", half)