Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change string to int javascript

//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: #change #string #int #javascript
ADD COMMENT
Topic
Name
2+8 =