Archived
With what case(s) will the following code display "Prohibition to go down the slide"?
let weight;
let height;
switch (weight > 40) {
case true :
console.log("You can slide");
break;
default :
if(height > 1.60) {
console.log("You can slide");
} else {
console.log("Prohibition to go down the slide");
}
}
1
Community Evaluations
Guillaume
22/02/2023
Si le poids n'est pas définie, undefined > 40 renverra false, donc on passe dans le default value. Donc Si taille = 1.60 fonctionne !
hugo
01/03/2023
je crois qu'il y a deux réponses valides, puisque la réponse : poids = 40 et taille = 1.60 est valide aussi. Perso ce qui me dérange c'est que sur chacune des questions je n'ai jamais le temps de relire. Si j'avais plus de temps pour me relire et vérifiier mon score passerait de 17/30 à 25/30. En somme 30 à 2 mins supplémentaires, car certains énnonces font plus de 500 caractères
10
Write a Javascript code that displays 'Adversity is not to be feared' and 'There is potentially a real danger'37
Write a JavaScript function that fetches data from an API and logs it to the console.10
The certificate variable is not attainable outside the if loop10
Use spread operator to split an array into two arrays in Javascript9
Write a switch statement that checks if a person can go down a slide based on their weight and height.90
Understanding the differences between `map()` and `forEach()` methods in JavaScript23
Fix the following Javascript loop: