JavaScript String Array Object
1995 - invented by Brendan Eich
2015 - ES6 - From March 2017 all browsers fully complaint
String
let text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let length = text.length;
let char = text[0];
let char1 = text.charAt(0);
let char2 = text.charCodeAt(0)[
text.split(" ");
text.padStart();
text.padEnd();
text.trimStart()
text.trimEnd()
text.concat()
text.toUpperCase()
text.toLowerCase()
text.replace()
text.replaceAll()
text.substring()
text.slice()
Search Methods
String indexOf()
String lastIndexOf()
String search()
String match()
String matchAll()
String includes()
String startsWith()
String endsWith()
Array
var myArray = [];
myArray.from('abc')
myArray.push('abc');
myArray.pop();
myArray.length
myArray.sort()
myArray.reverse()
myArray.forEach(a=>{a*a})
myArray.map(a=>{a+"space"})
myArray.keys()
myArray.entries()
myArray.filter(condition)
myArray.reduce()
myArray.includes('abc')
myArray.find(condition)
myArray.indexOf('abc')
myArray.lastIndexOf('a')
myArray.every(condition)
myArray.some(condition)
myArray.reduce() - myArray.reduceRight()
Object:
JavaScript built-in function JSON.parse() to convert the string into a JavaScript object
eg: const obj = JSON.parse(text);
The For Loop
for - loops through a block of code a number of times
for/in - loops through the properties of an object
for/of - loops through the values of an iterable object
Comments
Post a Comment