Answers for "tableau javascript"

0

tableau javascript

fruits.push('Mango');
// ["Strawberry", "Banana", "Mango"]

var pos = fruits.indexOf('Banana');
// 1
Posted by: Guest on September-28-2020
0

tableau javascript

var années = [1950, 1960, 1970, 1980, 1990, 2000, 2010];

console.log(années.0);  // erreur de syntaxe
console.log(années[0]); // fonctionne correctement
Posted by: Guest on September-28-2020
0

tableau javascript

var vegetables = ['Cabbage', 'Turnip', 'Radish', 'Carrot'];
console.log(vegetables); 
// ["Cabbage", "Turnip", "Radish", "Carrot"]

var pos = 1, n = 2;

var removedItems = vegetables.splice(pos, n); 
// n définit le nombre d'éléments à supprimer,
// à partir de la position pos

console.log(vegetables); 
// ["Cabbage", "Carrot"] (le tableau d'origine est changé)

console.log(removedItems); 
// ["Turnip", "Radish"] (splice retourne la liste des éléments supprimés)
Posted by: Guest on September-28-2020
0

tableau javascript

var promise = {
  'var' : 'text',
  'array': [1, 2, 3, 4]
};

console.log(promise['var']);
Posted by: Guest on September-28-2020
0

tableau javascript

renderer.3d.setTexture(model, "personnage.png");   // erreur de syntaxe
renderer["3d"].setTexture(model, "personnage.png");// fonctionne correctement
Posted by: Guest on September-28-2020
0

tableau javascript

var first = fruits[0];
// Apple

var last = fruits[fruits.length - 1];
// Banana
Posted by: Guest on September-28-2020
0

tableau javascript

var last = fruits.pop(); // supprime Orange (à la fin)
// ["Apple", "Banana"];
Posted by: Guest on September-28-2020
0

tableau javascript

console.log(arr.0); // erreur de syntaxe
Posted by: Guest on September-28-2020
0

tableau javascript

fruits.forEach(function(item, index, array) {
  console.log(item, index);
});
// Apple 0
// Banana 1
Posted by: Guest on September-28-2020
0

tableau javascript

var first = fruits.shift(); // supprime Apple (au début)
// ["Banana"];
Posted by: Guest on September-28-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language