javascript cut string
let str = 'John Wick'
let firstChar = str.charAt(0)
console.log(firstChar); // "J" var str = "Hello world That is reallly neat!";
var res = str.substring(0, 5);//get first 5 charsvar str = "Hello world!";
var res = str.substring(1, 4); //ellconst string = "0123456789";
console.log(string.slice(0, 2)); // "01"
console.log(string.slice(0, 8)); // "01234567"
console.log(string.slice(3, 7)); // "3456"var ret = "data-123".replace('data-','');
console.log(ret); //prints: 123
Also in JavaScript:
- javascript skip default parameter
- how to check if variable is array in javascript
- json parse
- Write a draw Chess Board function that accepts one parameter 'canvas' which is a canvas. It should draw an 8x8 chess board of #000 and #FFF squares. The top left corner should be a #FFF square
- antiforgerytoken mvc with ajax
- jquery use variable in string "without" concatenate
- find and replace value in array of objects javascript
- chroma js
- js how to know if element touch border
- redux fetch data using axios
- class component react
- node lodash documentation
- react native component at bottom center
- insert json into sql
- Javascript measure function run time
- json token for .ini file
- javascript if contains character
- div click outside to hide javascript
- javascript get the last array element
- update table remove a key from json object mysql
- javascript for loop[
- get child element by class javascript
- Javascript format to currency
- jquery reload page