how to get the first character of a string in javascript
let str = 'John Wick'
let firstChar = str.charAt(0)
console.log(firstChar); // "J" var str="Hello Folks!"
var firstStringChar = str.charAt(0); //Hconst string = "0123456789";
console.log(string.slice(0, 2)); // "01"
console.log(string.slice(0, 8)); // "01234567"
console.log(string.slice(3, 7)); // "3456"
Also in JavaScript:
- select with row id d3.js
- javascript string in multiple lines
- js for of loop
- array in js
- double click on element using javascript
- chai js
- check data type in js
- javascript prevent value change in select option
- js validate email
- compare two arrays and make sure there are no duplicates js
- how to update node modules
- chart.js y axis maximum value
- how to deploy react app firebase
- javascript after 2 months date find
- jquery onclick function show alert
- how to pass variable via component after it's updated angular
- how to detect a keypress in javascript
- how to get a due date from current date in javascript
- document jquery
- toggle class to an element javascript
- today's time in javascript
- js slice string at word
- javascript natural log
- jquery remove array element by key