Answers for "get character index javascript"

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 character at index in javascript

var string = "Hello, World!";
console.log( string.charAt(4) ); // "o"
Posted by: Guest on September-24-2021
1

find character at index in javascript

var string = "Hello, World!";
console.log( string[4] ); // "o"
Posted by: Guest on September-24-2021
1

make indexOF in js

function indexOf(arr, value) {
  for (let [i, e] of arr.entries()) {
    if (value == e) return i;
  }
  return -1;
}
indexOf([1,2,3], 2);                     //returns 1
Posted by: Guest on November-04-2020

Code answers related to "get character index javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language