This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
background-color: #eee; | |
margin-left: 30px; | |
margin-right: 30px; | |
} | |
span { | |
font-weight: normal; | |
font-size: 80%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// affiche “Vrai” si la chaîne compte autant de “x” que de “o”. | |
var chaine = "xoxxooxoxxxoooo"; | |
var x = 0; | |
var o = 0; | |
for (var i = 0; i < chaine.length; i++) { | |
if (chaine[i] === "x") { | |
x++; | |
} else if (chaine[i] === "o") { | |
o++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Activité : gestion des contacts | |
*/ | |
// TODO : complétez le programme | |
var Contact = { | |
// initialisation du contact | |
init: function (nom, prenom) { | |
this.prenom = prenom; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* La fenêtre de saisie se charge en 1er et n'affiche | |
pas le console.log tant qu'elle n'est pas validée. | |
Comment afficher les 2 simultanément ? */ | |
console.log('merci de répondre à ce questionnaire'); | |
var plat = prompt("Quel est votre plat préféré ?"); | |
switch(plat) // debut du switch | |
{ | |
case "frites": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Film = { | |
// Initialise le film | |
init: function (titre, annee) { | |
this.titre = titre; | |
this.annee = annee; | |
}, | |
// Renvoie la description du film | |
decrire: function () { | |
var description = this.titre + " (" + this.annee + ")"; | |
return description; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Chien = { | |
init: function (nom, race, taille) { | |
this.nom = nom; | |
this.race = race; | |
this.taille = taille; | |
}, | |
aboyer: function () { | |
var description = " Grrr! Grrr! "; | |
return description; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkThatTwoPlusTwoEqualsFourAMillionTimes = () => { | |
for(let i = 1; i <= 1000000; i++) { | |
if ( (2 + 2) != 4) { | |
console.log('Something has gone very wrong :( '); | |
} | |
} | |
}; | |
const addTwo = num => num + 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dogYears = 20; | |
let earlyYears = 2; | |
earlyYears *= 10.5; | |
let laterYears = dogYears-2; | |
laterYears *= 4; | |
let dogYearsInHumanYears = earlyYears+laterYears | |
console.log(dogYearsInHumanYears); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// forecast today | |
let kelvin = 293; | |
let celsius = kelvin-273; | |
let fahrenheit = celsius*(9/5)+32; | |
let newton = celsius*(33/100); | |
// .floor() method from the Math library to round down the Fahrenheit temperature | |
fahrenheit = Math.floor(fahrenheit); | |
newton = Math.floor(newton); | |
celsius = Math.floor(celsius); | |
console.log('The temperature is '+ fahrenheit + ' degrees Fahrenheit. '+ celsius + ' degrees Celsius. ' + newton + |