+ 1
How to get two characters from a string?
How to get two characters from a string? example: var x = "hello"; i need get two char from string => "he";
6 Respuestas
+ 1
I think you can go with slice
syntax
.slice(start, end)
So example
var x = “hello”;
console.log(x.slice(0, 3));
+ 1
var x = "hello";
var [y, z] = [...x];
console.log(y+z);
0
Faisal Issaka thank u very much u saved me.
0
You are welcome
0
str.slice(0,2)
- 2
No it's not a .slice(start, end)
Its a string x = ( 0, 1)