intval js
parseInt(value);
let string = "321"
console.log(string); // "321" <= string
let number = parseInt(string);
console.log(number) // 321 <=int
Joyous Jaguar
parseInt(value);
let string = "321"
console.log(string); // "321" <= string
let number = parseInt(string);
console.log(number) // 321 <=int
var myInt = parseInt("10.256"); //10
var myFloat = parseFloat("10.256"); //10.256
function atoi(erin, isunsigned) {
var retnum = 0;
for (var i = 0; i < 2; i++) {
retnum += erin.charCodeAt(i) << (i * 8);
}
return (isunsigned == true) ? Int16(retnum) : retnum;
}
var UInt16 = function (value) {
return (value & 0xFFFF);
};
var Int16 = function (value) {
var ref = UInt16(value);
return (ref > 0x7FFF) ? ref - 0x10000 : ref;
};