Michael Shtefanitsa Michael Shtefanitsa - 1 month ago 7
Javascript Question

How to concatenate two digits with saving integer properties JavaScript

Hello i want to concatenate two digits or numbers, but with saving properties of integer format, not like char

var a = 100 ;
var b = 10 ;
var c = "" + a + b;
return c


'10010' - this is (char)
i need (integer)

sam sam
Answer

You can convert your string into number using parseInt()

var a = 100 ;
var b = 10 ;
var c = parseInt(a + "" + b);
return c