This file contains hidden or 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 total = arr.reduce((res,v) => res += v[1], 0); | |
| arr = arr.map(value => [value[0], value[1] / total * 100]); | |
| let benfordLaw = { | |
| '1': 30.1, | |
| '2': 17.6, | |
| '3': 12.5, | |
| '4': 9.7, | |
| '5': 7.9, | |
| '6': 6.7, | |
| '7': 5.8, |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| > lemeilleurcoin@1.0.0 test /Users/jeremy/Desktop/github/lemeilleurcoin | |
| > jest | |
| (node:3234) ExperimentalWarning: The fs.promises API is experimental | |
| PASS tests/commun.test.js (8.881 s) | |
| Conversion de surfaces | |
| ✓ convertir 7 m² en 7 m² (3 ms) | |
| ✓ convertir 7 M² en 7 m² | |
| ✓ convertir 7 M² en 7 m² |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| > lemeilleurcoin@1.0.0 test /Users/jeremy/Desktop/github/lemeilleurcoin | |
| > jest | |
| (node:1851) ExperimentalWarning: The fs.promises API is experimental | |
| PASS tests/commun.test.js (9.408 s) | |
| Conversion de surfaces | |
| ✓ convertir 7 m² en 7 m² (2 ms) | |
| ✓ convertir 7 M² en 7 m² | |
| ✓ convertir 7 M² en 7 m² |
This file contains hidden or 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
| // ==UserScript== | |
| // @name Le Meilleur Coin | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.0 | |
| // @description Make the bon coin a better place AH AH AH AH | |
| // @author Jérémy Mouzin | |
| // @match https://www.leboncoin.fr/ventes_immobilieres/* | |
| // @grant none | |
| // ==/UserScript== |
This file contains hidden or 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
| // Version lisible pour les débutants | |
| function maxMultiple(diviseur, limite) { | |
| // On part de la limite et on teste chaque valeur | |
| for (let i = limite; i > 0; i--) { | |
| // Si i est divisible par diviseur, son reste de la | |
| // division euclidienne de i par diviseur sera 0 | |
| if (i % diviseur === 0) { | |
| return i; | |
| } | |
| } |
This file contains hidden or 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
| // Version lisible pour les débutants | |
| function largestNumber(num) { | |
| // On concatène plusieurs 9 côte à côte | |
| const nombreChaine = '9'.repeat(num); | |
| // On convertit la chaîne en un nombre | |
| return Number(nombreChaine); | |
| } | |
| // Version compacte de la solution précédente | |
| function largestNumber(num) { |
This file contains hidden or 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
| // Version lisible pour les débutants | |
| // Gère les espaces dans chaine | |
| function firstDigit(chaine) { | |
| for (caractere of chaine) { | |
| if ("0123456789".includes(caractere)) { | |
| return caractere; | |
| } | |
| } | |
| } |
This file contains hidden or 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
| // Solution classique grâce à la récursivité | |
| function factorialNumber(num) { | |
| if (num !== 1) { | |
| return num * factorialNumber(num - 1); | |
| } else return 1; | |
| } | |
| // Solution sans récursivité | |
| function factorialNumber(num) { | |
| let resultat = 1; |
This file contains hidden or 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
| // Solution simple via concaténation | |
| function encloseInBrackets(chaine) { | |
| return '(' + chaine + ')'; | |
| } | |
| // Solution simple via template strings | |
| function encloseInBrackets(chaine) { | |
| return `(${chaine})`; | |
| } |
This file contains hidden or 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
| // Version lisible pour débutants | |
| function caseInsensitivePalindrome(mot) { | |
| // On met tout en minuscules pour rester insensible à la casse | |
| mot = mot.toLowerCase(); | |
| // On transforme la chaîne en tableau de caractères... | |
| let palindrome = mot.split(''); | |
| // ...pour pouvoir utiliser les méthodes des tableaux | |
| // et ainsi "retourner" facilement le mot | |
| palindrome = palindrome.reverse().join(''); | |
| // On teste si le mot retourné est égal au mot |
NewerOlder