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 isVowel = (c: string) => 'aeiouy'.includes(c) | |
const yay = (word: string) => word + (isVowel(word[word.length - 1]) ? 'y' : '') + 'ay' | |
const isUpperString = (c: string) => c === c.toUpperCase() | |
const hasUpperCharacter = (word: string) => word.split('').find(isUpperString) | |
const restablishCase = (word: string) => hasUpperCharacter(word) | |
? word[0].toUpperCase() + word.substring(1).toLowerCase() | |
: word; | |
const toPigLatinWord = (word: string) => { |
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
let x: number = 0 | |
// Fonction pure: ne modifie pas x | |
function add(value: number) { | |
return x + value | |
} | |
// Fonction impure: modifie x | |
function incrementBy(value: number) { | |
x += value; |