Here is my javascript code impossible to turn on cloud 9,


#1

Hi

Here is my javascript code impossible to turn on cloud 9, when I run “run” I have a process message exited code1.

var prenoms = [‘Pierre’, ‘Victor’, ‘Julia’, ‘Claire’];

prenoms[prenoms.length] = ‘Florian’;
prenoms[prenoms.length] = ‘chloe’;

alert(‘on a ajouté’ + prenoms[4]+ ‘et’ + prenoms[5] + ‘à notre tableau’);
console.log(prenoms[3]);

var prenoms = [‘Pierre’, ‘Victor’, ‘Julia’, ‘Claire’], p = ‘’;

p+= ‘Prenom n°’ + (i+1) + ‘:’ + prenoms[i] + ‘\n’;
alert§;

var prenoms = [‘Pierre’, ‘Victor’, ‘Julia’, ‘Claire’], p = ‘’;
for(var i= 0; i < prenoms.length; i++){
p+= ‘Prenom n°’ + (i+1) + ‘:’ + prenoms[i] + ‘\n’;
}
alert§;

I start to learn js and coding
Merci pour votre aide, je suis en initiation en js!


#2

Is there any error above the exited code1 message?
Most likely there should be something about alert being undefined, because
’run’ command executes code on nodejs, where there is no alert
You can use console.log instead of alert, or load js file as a script in html file, and preview the html file.


#3

Thanks so match Haroutioun it s work when i put my code in html code!!

Have fun!!