Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajouter une solution alternative #18

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from

Conversation

xiaoouwang
Copy link

ajouter une solution alternative

ajouter une solution alternative
@xiaoouwang xiaoouwang changed the title Update chapitre8_exercice3.js ajouter une solution alternative Feb 9, 2019
@Voodooa
Copy link

Voodooa commented Jun 9, 2019

function convertirLettreLeet(lettre) {
let result = lettre;
if (lettre === "a") {result = 4}
else if (lettre === "b") {result = 8}
else if (lettre === "e") {result = 3}
else if (lettre === "l") {result = 1}
else if (lettre === "o") {result = 0}
else if (lettre === "s") {result = 5}
return result;
}

function convertirMotLeet(mot) {
let total =""
for (let i = 0; i < mot.length; i++) {
convertirLettreLeet(mot[i]); total += convertirLettreLeet(mot.toLowerCase()[i]);
};
return total;}

console.log(convertirMotLeet("HELLO WORLD")); // "H3110 W0r1d!"
console.log(convertirMotLeet("Noob")); // "N008"
console.log(convertirMotLeet("Hacker")); // "H4ck3r"

@Voodooa
Copy link

Voodooa commented Jun 9, 2019

Bonjour, je suis nouveau sur le site, est-ce le bon endroit pour proposer une solution alternative à l'exercice 2 du chapitre 8 Javascript ?
Merci pour votre aide !

@baboulahi
Copy link

baboulahi commented Jun 9, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants