Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js string to int

//shorthand method for casting a string into an int
let string = '1776';
let total = 10 - +string;
//above the addition symbol does the same as parseInt(string);
//result: total = 1766
Source by thecodingcompany.hashnode.dev #
 
PREVIOUS NEXT
Tagged: #js #string #int
ADD COMMENT
Topic
Name
8+8 =