Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to convert string into int js

//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: #convert #string #int #js
ADD COMMENT
Topic
Name
9+6 =