javascript get first 2 char
String.substring(0, 2);
//Return the first two characters of the string
//First parameter is the starting index, 0 corresponding to the first character
//Second parameter is the number of character to returnvar str = "Hello world That is reallly neat!";
var res = str.substring(0, 5);//get first 5 charsconst 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:
- javascript last element of array
- how to modify an array
- how to get all elements with same class in javascript
- console log larger
- javascript pluck from array of objects
- javascript get unique values from array
- checking if a user has a role in discord js
- how to check if input is checked javascript
- criar objeto javascript
- Trouble setting up sample table. “Could not find matching row model for rowModelType clientSide”
- angular one array contains any of second
- js array map skip element
- Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.
- placeholder in angular 9 select with working required
- inject image javascript
- jquery validator Url
- recuperer une image dans la base de données avec angular
- javascript closure inside loop
- array map order by timestamp reactjs
- js join a list of items with a number
- minus month javascript date
- 404 page setup in angular routing
- for of mdn
- javascript add item to list