Answers for "js string first n character"

14

how to get the first character of a string in javascript

let str = 'John Wick'
let firstChar = str.charAt(0) 
console.log(firstChar); // "J"
Posted by: Guest on November-16-2020
2

js only first 50 letters

'Hiya how are you'.substring(0,50);
Posted by: Guest on December-30-2020
1

javascript only allow show first few characters from a string

var string = 'Hey, I am good';
string.substring(0,3); // show first 3 characters
//result "Hey"
Posted by: Guest on December-10-2020

Code answers related to "js string first n character"

Code answers related to "Javascript"

Browse Popular Code Answers by Language