Skip to content

ajouter une solution alternative#18

Open
xiaoouwang wants to merge 1 commit into
thejsway:gh-pagesfrom
xiaoouwang:patch-2
Open

ajouter une solution alternative#18
xiaoouwang wants to merge 1 commit into
thejsway:gh-pagesfrom
xiaoouwang:patch-2

Conversation

@xiaoouwang

Copy link
Copy Markdown

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

Voodooa commented Jun 9, 2019

Copy link
Copy Markdown

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

Voodooa commented Jun 9, 2019

Copy link
Copy Markdown

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

baboulahi commented Jun 9, 2019 via email

Copy link
Copy Markdown

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