Flashcards
JS-Section2
Cards in this deck (24)
- 1Number of data types in JS.Number
String
Boolean
Null : Explicitly sets a variable with no value
Undefined : For variables that have not yet been defined
Object : Complex data structures
Symbol : Used with objects.
JS is loosely typed language - 2Getting a character of a string fullNameconsole.log(fullName[0]);
- 3Getting the length of the string fullNameconsole.log(fullName.length);
- 4Pour mettre en Majuscule ou en minuscule :fullName.toUpperCase();
fullName.toLowerCase(); - 5find the position of a character inside a string :fullName.indexOf('a')
- 6Avoir la dernière apparition d’une lettre d’un stringfullName.lastIndexOf(‘n);
- 7Couper la partie d’un string :fullName.slice(0, 10)
The first argument is where we want the slice from. The next is when we where we want it to stop.
Ou
let result = email.substr (0,10) /* starts at 0, and gets 10 characters */ - 8Remplacer un caractère par un autre dans un stringlet result = email.replace('m', 'w');
Le premier m rencontré sera remplacé par w. - 93 puissance 5let result = 3**5
- 10order of operations :BIDMAS
- 11add ten to resultresult = result + 10;
result += 10; - 12const title = 'Best reads of 2019'; const author = 'Mario'; const likes = 30; Make template strings with those and the phrase "The blog called (title) by (author has (likes) likes"let result = `The blog called ${title} by ${author} has ${likes} likes`;
- 13const title = 'Best reads of 2019'; const author = 'Mario'; const likes = 30; Creating html templateslet html = `
${title}
By ${author}
This blog has ${likes} likes
`; - 14Array with 3 elements : let ninjas = ['shaun', 'ryu', 'chun-li']; Quelle commande donnera Ryu.console.log(ninjas[1]);
- 15Array with 3 elements : let ninjas = ['shaun', 'ryu', 'chun-li']; Quelle commande remplace Ryu par ken ?ninjas[1] = 'ken';
- 16Afficher la longueur de l'arrayconsole.log(ninjas.length);
- 17Quelle commande permet d'afficher chaque élément du tableau séparé par une virgule.console.log(ninjas.join(','));
- 18Savoir quelle est la position de chun-li dans l'arraylet result = ninjas.indexOf('chun-li');
- 19Quelle commande permet de concatenner ken et crystal avec l’array ninja.let result = ninjas.concat(['ken', 'crystal']);
- 20Quelle commande permet de concatainer l’array ages et l’array ninjas.let result = ninjas.concat(ages);
- 21What method can add Ken at the end of the array ?let result = ninjas.push('ken');
- 22How to take off the last value of the arraylet result = ninjas.pop();
- 23How to display the last value of the array ?console.log(ninjas.pop());
- 24—
Information
- Description
- vaze JS-EASY Flashcards on JS-Section2, created by dadou siplancin on 25/11/2021.
- Created by
- dadou siplancin
- Views
- 0
- Rating