(12,'Raccourcisseurs de liens','linkShortener','Une URL trop longue ? Raccourcissez-là !','/images/functions/linkShortener.png','form',NULL,'[{\"name\": \"url\", \"type\": \"text\", \"label\": \"Entrez le lien à raccourcir :\", \"placeholder\": \"(e.g : https://divlo.fr)\"}, {\"name\": \"shortcutName\", \"type\": \"text\", \"label\": \"Entrez le nom du raccourci :\", \"placeholder\": \"(e.g : divlo)\"}]',1,'2019-12-11 00:00:00','2020-04-27 16:31:38',1),
(13,'Liste de choses à faire','toDoList','Prévoyez la liste de choses que vous devez faire.','/images/functions/toDoList.png','page',NULL,NULL,1,'2019-12-26 00:00:00','2020-04-27 16:34:34',1),
(14,'Juste Prix','rightPrice','Arriverez-vous à deviner le prix d\'unobjet?', '/images/functions/rightPrice.png', 'page', NULL, NULL, 1, '2020-04-2720:17:05', '2020-04-2721:59:22', 3),
(15,'Chronomètre','chronometerTimer','Gérer votre temps facilement (et adopter la technique Pomodoro).','/images/functions/chronometerTimer.png','page',NULL,NULL,1,'2020-04-29 09:28:08','2020-04-29 09:45:29',1);
(16,'Les méthodes des tableaux','arrayMethods','Et si on refaisait les méthodes natives de l\'objetglobal\"Array\"?', '/images/functions/arrayMethods.png', 'article', '<p><strong>JavaScript</strong>estunlangage<strong>orientéobjet</strong>,chaquetypecomme\"String\", \"Number\",...sontenréalitédesobjets. <br>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nCesontdes\"<a target=\"_blank\" href=\"https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux\">Objets globaux</a>\",quidisposedeméthodesbienutiles.😎 Pourquoijevousditça?<br>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nCaraujourd\"hui nous allons reproduire les méthodes de l\"objetglobal\"<a target=\"_blank\" href=\"https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Array\">Array</a>\", c\"est un bon exercice pour progresser.<br>\n<br>\n\n\n\n\n\n\n\n\n\n\n\nNous allons réaliser une classe (syntaxe ES6+) qu\"onvaappeler\"DivloArray\"parexempleetreproduire6méthodes(push,forEach,map,filter,reverseetjoin),bienévidemmentlibreàvousd\"en faire plus. 😊 Je vais expliquer le code une méthode après l\"autredoncboutdecodeparboutdecode,sivousvoulezavoirlecodesourcecomplet,ilestdisponiblesurce<atarget=\"_blank\"href=\"https://gist.github.com/Divlo/4ffc8ed007d293372ee449d2647fcad9\">GitHubGist.</a><br>\n<br>\n\n\n\n\n\n\n\n\n\n\nDonctoutd\"abord, nous devons créer la classe avec un constructor et faire une nouvelle instance de cet objet dans une variable :<br>\n\n\n\n\n\n\n\n\n(Libre à vous de renommer les variables comme bon vous semble.) <br>\n</p><div class=\"vscode-editor\" style=\"color:#d4d4d4;background-color: #1e1e1e;font-family: Consolas, \'Courier New\', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;\"><div><span style=\"color: #569cd6;\">class</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #4ec9b0;\">DivloArray</span><span style=\"color: #d4d4d4;\"> {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #569cd6;\">constructor</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">) {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\"> }</span></div><div><span style=\"color: #d4d4d4;\">}</span></div><br>\n\n<div><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">divloArray</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #569cd6;\">new</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #4ec9b0;\">DivloArray</span><span style=\"color: #d4d4d4;\">([</span><span style=\"color: #b5cea8;\">57</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color: #b5cea8;\">4</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color: #b5cea8;\">2</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color: #b5cea8;\">8</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color: #b5cea8;\">16</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color: #b5cea8;\">25</span><span style=\"color: #d4d4d4;\">]);</span></div></div><p><br>\n\n\n\n\n\n\n- Nous allons commencer par créer la première méthode très utilisée qui consiste à ajouter un ou plusieurs éléments à la fin d\"un tableau, je parle bien évidemment de la méthode <strong>push</strong>.</p><div class=\"vscode-editor\" style=\"color: #d4d4d4;background-color: #1e1e1e;font-family: Consolas, \'Courier New\', monospace;font-weight:
(17,'Est-ce un palindrome ?','isPalindrome','Un palindrome est un mot (ou phrase) qui peut s\'écriredanslesdeuxsens(ex:kayak).', '/images/functions/isPalindrome.png', 'form', '<p>Pourréfléchirsurunproblème,ilfautle\"découper\"enpetitsautresproblèmes,unpalindromeestunmotquipeuts\"écrire dans les deux sens, donc le mot avec les lettres inversées devrait être exactement le même que le mot initial.<br>\n\n\nDonc pour cela faut d\"abordfaireunefonctionquivaretournerlachaînedecaractèreàl\"envers, par exemple : \"Hello\" devient \"olleH.</p><p>Jevaisvousmontrer2techniquesdifférentespourarriveràécrirelafonction\"reverseString\":</p><p>-1èreméthodeconsisteàsimplementfaireuneboucleàl\"envers :</p><div class=\"vscode-editor\" style=\"color:#d4d4d4;background-color: #1e1e1e;font-family: Consolas, \'Courier New\', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;\"><div><span style=\"color: #569cd6;\">function</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #dcdcaa;\">reverseString</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">) {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #ce9178;\">\"\"</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #51b6c4;\">stringLength</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">length</span><span style=\"color: #d4d4d4;\"> - </span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #c586c0;\">for</span><span style=\"color: #d4d4d4;\"> (</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #9cdcfe;\">stringLength</span><span style=\"color: #d4d4d4;\">; </span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\"> >= </span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">; </span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">--) {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\"> += </span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">[</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">];</span></div><div><span style=\"color: #d4d4d4;\"> }</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">}</span></div></div><p>- 2ème méthode qui tient sur une seule ligne grâce aux méthodes des objets globaux :</p><div class=\"vscode-editor\" style=\"color: #d4d4d4;background-color: #1e1e1e;font-family: Consolas, \'Courier New\', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;\"><div><span style=\"color: #569cd6;\">function</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #dcdcaa;\">reverseString</span><span style=\"color: #d4d4d4;\">(</span><s
(18,'Quel est le mot le plus long ?','findLongestWord','Trouve le mot le plus long dans une chaîne de caractères.','/images/functions/findLongestWord.png','form','<p></p><div class=\"vscode-editor\" style=\"color: #d4d4d4;background-color: #1e1e1e;font-family: Consolas, \'CourierNew\', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;\"><div><span style=\"color: #569cd6;\">function</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #dcdcaa;\">findLongestWord</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">) {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #51b6c4;\">arrayString</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">split</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #ce9178;\">\" \"</span><span style=\"color: #d4d4d4;\">);</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">wordLength</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">wordResult</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #ce9178;\">\"\"</span><span style=\"color: #d4d4d4;\">;</span></div><br><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">arrayString</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">forEach</span><span style=\"color: #d4d4d4;\">((</span><span style=\"color: #9cdcfe;\">word</span><span style=\"color: #d4d4d4;\">) </span><span style=\"color: #569cd6;\">=></span><span style=\"color: #d4d4d4;\"> {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\"> (</span><span style=\"color: #9cdcfe;\">word</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">length</span><span style=\"color: #d4d4d4;\"> > </span><span style=\"color: #9cdcfe;\">wordLength</span><span style=\"color: #d4d4d4;\">) {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">wordResult</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #9cdcfe;\">word</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">wordLength</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #9cdcfe;\">word</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">length</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\"> }</span></div><div><span style=\"color: #d4d4d4;\"> });</span></div><br><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">wordResult</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">}</span></div></div><p>On part du principe que chaque mot est séparé par des espaces. Au début, le mot le plus long a 0 caractère. Puis on fait un
(19,'Suite de Fibonacci','fibonacci','Calcule la suite de Fibonacci.','/images/functions/fibonacci.png','form','<p>La suite de Fibonacci est une suite d\"entiers dans laquelle chaque terme est la somme des deux termes qui le précèdent, voici les 6 premiers chiffres de la suite :<br>\n\n\n\n\n\n0, 1, 1, 2, 3, 5</p><p>Nous allons coder une fonction récursive qui va nous calculer les \"x\" premiers nombres de la suite.</p><p>Pour commencer qu\"est ce qu\"une fonction récursive ? Une fonction récursive est une fonction qui s\"auto appelle dans le corps de la fonction, exemple :</p><div class=\"vscode-editor\" style=\"color: #d4d4d4;background-color: #1e1e1e;font-family: Consolas, \'CourierNew\', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;\"><div><span style=\"color: #569cd6;\">function</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #dcdcaa;\">doSomeCode</span><span style=\"color: #d4d4d4;\">() {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #dcdcaa;\">doSomeCode</span><span style=\"color: #d4d4d4;\">();</span></div><div><span style=\"color: #d4d4d4;\">}</span></div><div><span style=\"color: #dcdcaa;\">doSomeCode</span><span style=\"color: #d4d4d4;\">();</span></div></div><p>Bon ici, ça n\"a pas trop de sens, car ça causerait \"une boucle infinie\" on obtiendra une \"InternalError: too much recursion\", par contre si on exécute la fonction ou on retourne une valeur d\"après des conditions, ça peut-être très intéressant.</p><div class=\"vscode-editor\" style=\"color: #d4d4d4;background-color: #1e1e1e;font-family: Consolas, \'CourierNew\', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;\"><div><span style=\"color: #569cd6;\">function</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #dcdcaa;\">fibonacci</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\"> = [], </span><span style=\"color: #9cdcfe;\">number1</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color: #9cdcfe;\">number2</span><span style=\"color: #d4d4d4;\"> = </span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">) {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\"> (</span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\"> === </span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">) {</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\">; </span></div><div><span style=\"color: #d4d4d4;\"> }</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\">--;</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">push</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">number1</span><span style=\"color: #d4d4d4;\">);</span></div><div><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\"> </span><span style=\"color: #dcdcaa;\">fibonacci</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\">, </span><span style=\"color