I want to be able to combine numbers as strings.
1 & 2 = 12
or
if (min<10){
min = 0 & min
}
The “&” sign does not work. Any suggestions?
I want to be able to combine numbers as strings.
1 & 2 = 12
or
if (min<10){
min = 0 & min
}
The “&” sign does not work. Any suggestions?
You need to use the “+” instead of the “&” sign.
You can use the String object, or the toString method to work with them as strings, or just use an actual string.
var a = 1,
b = 2,
c = String(a) + String(b);
var a = 1,
b = 2,
c = a.toString() + b.toString();
if (min < 10) {
min = '0' + min;
}