Answers for "get char from string js"

12

javascript get first character of string

var str="Hello Folks!"
var firstStringChar = str.charAt(0); //H
Posted by: Guest on August-01-2019
1

find char in string javascript

var str = "Hello world, welcome to the universe.";

var n = str.indexOf("e");
Posted by: Guest on February-19-2021
2

javascript get character from string

// (ES6 / ES2015)+ way of doing it
const str = "Hello World!";
const chars = [...str];

// Pre-ES2015 way of doing it
var chars2 = str.split("");
Posted by: Guest on February-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language