-4
J'ai besoin d'aide avec ce code. Je reçois une erreur de jeton inattendue.Ajout de deux variables pour vider un tableau en utilisant la méthode push
SyntaxError: Unexpected token, expected ; (8:11)
- Declare two variables, a string and an integer named fullName and birthYear, and set them equal to "Linus Torvalds" and 1969.
var fullName="Linus Torvalds";
var birthYear= 1969;
- Declare an empty array called myArray.
var myArray=[];
- Add the variables from #1 (fullName and birthYear) to myArray using the push method. Print myArray to the console.
myArray.push(fullName, birthYear);
console.log(myArray);
Quel est votre code? – cpugourou
Ce code fonctionne très bien. Quel est ton environnement? Navigateur (lequel)? Node.js? – randomir
Fournissez la trace de la pile, s'il vous plaît. 'Erreur de jeton inattendue' peut signifier n'importe quoi. –