This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/.github/backup.sql

31 lines
92 KiB
MySQL
Raw Normal View History

/* categories */
INSERT INTO `categories` (`id`, `name`, `color`, `createdAt`, `updatedAt`) VALUES
(1, '✨ Utilitaires', '#720fc0', '2020-03-20 00:00:00', '2020-03-20 00:00:00'),
(2, '💻 Algorithmes', '#0a4c82', '2020-03-20 00:00:00', '2020-03-20 00:00:00'),
(3, '🕹️ Jeux', '#a10b0b', '2020-03-20 00:00:00', '2020-03-20 00:00:00'),
(4, '📝 Divers', '#333434', '2020-03-20 00:00:00', '2020-03-20 00:00:00');
/* functions */
INSERT INTO `functions` (`id`, `title`, `slug`, `description`, `image`, `type`, `article`, `utilizationForm`, `isOnline`, `createdAt`, `updatedAt`, `categorieId`) VALUES
(1, 'Météo', 'weatherRequest', 'Affiche la météo et l\'heure locale.', '/images/functions/weatherRequest.png', 'form', '<p>Pour une meilleure précision, je recommande de préciser le pays de la ville. Il faut rentrer le nom anglais de la ville (s\"il est différent qu\"en français).</p><p>Exemples : Paris, FR - London, UK - Moscow, RU - etc.</p><p>La météo est récupérée grâce à l\"API&nbsp;<a rel=\"noopener noreferrer\" target=\"_blank\" href=\"https://openweathermap.org/\">openweathermap.org</a>, une simple requête GET.</p>', '[{\"name\": \"cityName\", \"type\": \"text\", \"label\": \"Entrez le nom d\'une ville :\", \"placeholder\": \"(e.g : Paris, FR)\"}]', 1, '2019-08-16 00:00:00', '2020-05-08 13:43:26', 1),
(2, 'Nombre aléatoire', 'randomNumber', 'Génère un nombre aléatoire entre un minimum inclus et un maximum inclus.', '/images/functions/randomNumber.png', 'form', '<p>Simple fonction très utile dans de nombreux cas, qui permet de générer un nombre aléatoire entre un nombre minimum et un nombre maximum :</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;\">&nbsp;</span><span style=\"color: #dcdcaa;\">randomNumber</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">min</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">max</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #4ec9b0;\">Math</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">floor</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #4ec9b0;\">Math</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">random</span><span style=\"color: #d4d4d4;\">()&nbsp;*&nbsp;(</span><span style=\"color: #9cdcfe;\">max</span><span style=\"color: #d4d4d4;\">&nbsp;-&nbsp;</span><span style=\"color: #9cdcfe;\">min</span><span style=\"color: #d4d4d4;\">&nbsp;+</span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">))&nbsp;+&nbsp;</span><span style=\"color: #9cdcfe;\">min</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">}</span></div></div>', '[{\"name\": \"min\", \"type\": \"integer\", \"label\": \"Entrez la valeur minimale :\", \"placeholder\": \"(e.g : 1)\"}, {\"name\": \"max\", \"type\": \"integer\", \"label\": \"Entrez la valeur maximale :\", \"placeholder\": \"(e.g : 100)\"}]', 1, '2019-08-16 00:00:00', '2020-05-08 13:23:22', 2),
(3, 'Quel âge avez-vous ?', 'calculateAge', 'Calcule l\'âge selon la date de naissance.', '/images/functions/calculateAge.png', 'form', '<p>Grâce à la librairie \"Moment.js\" c\"est très simple&nbsp; :&nbsp;</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;\">&nbsp;</span><span style=\"color: #dcdcaa;\">calculateAge</span><span style=\"color: #d4d4d4;\">({&nbsp;</span><span style=\"color: #9cdcfe;\">birthDateDay</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">birthDateMonth</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">birthDateYear</span><span style=\"color: #d4d4d4;\">&nbsp;})&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">currentDate</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #569cd6;\">new</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #4ec9b0;\">Date</span><span style=\"color: #d4d4d4;\">();</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">day</span><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">currentDate</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">getDate</span><span style=\"color: #d4d4d4;\">();</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">month</span><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">currentDate</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">getMonth</span><span style=\"color: #d4d4d4;\">();</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">currentDateMoment</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #dcdcaa;\">moment</span><span style=\"color: #d4d4d4;\">([</span><span style=\"color: #9cdcfe;\">currentDate</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">getFullYear</span><span style=\"color: #d4d4d4;\">(),&nbsp;</span><span style=\"color: #9cdcfe;\">month</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">day</span><span style=\"color: #d4d4d4;\">]);</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">birthDateMoment</span><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;=&nbsp;</span><span style=\"color: #dcdcaa;\">moment</span><span style=\"color: #d4d4d4;\">([</span><span style=\"color: #9cdcfe;\">birthDateYear</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">birthDateMonth</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">birthDateDay</span><span style=\"color: #d4d4d4;\">]);</span></div><br><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #6a9955;\">//&nbsp;Calcule&nbsp;l\'âge&nbsp;-&nbsp;Moment.js</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">ageYears</span><span style=\"color: #d4d4d4;\">&
(4, 'Conversion de Température', 'convertTemperature', 'Convertis des Degré Celsius en Degré Fahrenheit et l\'inverse aussi.', '/images/functions/convertTemperature.png', 'form', '<p>Cette fonction n\"est pas trop intéressante, c\"est juste de l\"application de formules :</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: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@description</span><span style=\"color: #6a9955;\">&nbsp;Convertis&nbsp;des&nbsp;°C&nbsp;en&nbsp;°F&nbsp;et&nbsp;l\'inverse&nbsp;aussi.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@param</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #4ec9b0;\">{number}</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #9cdcfe;\">degree</span><span style=\"color: #6a9955;\">&nbsp;-&nbsp;Nombre&nbsp;de&nbsp;degrès</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@param</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #4ec9b0;\">{string}</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #9cdcfe;\">unit</span><span style=\"color: #6a9955;\">&nbsp;-&nbsp;Unité&nbsp;du&nbsp;nombre&nbsp;(°C&nbsp;ou&nbsp;°F)&nbsp;après&nbsp;conversion</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@returns</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #4ec9b0;\">{object}</span><span style=\"color: #6a9955;\">&nbsp;le&nbsp;nombre&nbsp;résultat</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@examples</span><span style=\"color: #6a9955;\">&nbsp;convertTemperature(23,&nbsp;\'°F\')&nbsp;→&nbsp;73.4</span></div><div><span style=\"color: #6a9955;\">&nbsp;*/</span></div><div><span style=\"color: #569cd6;\">function</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #dcdcaa;\">convertTemperature</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">degree</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">unit</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">temperatureValue</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\">&nbsp;(</span><span style=\"color: #9cdcfe;\">unit</span><span style=\"color: #d4d4d4;\">&nbsp;===&nbsp;</span><span style=\"color: #ce9178;\">\"°C\"</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">temperatureValue</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;(</span><span style=\"color: #9cdcfe;\">degree</span><span style=\"color: #d4d4d4;\">&nbsp;-&nbsp;</span><span style=\"color: #b5cea8;\">32</span><span style=\"color: #d4d4d4;\">)&nbsp;*&nbsp;</span><span style=\"color: #b5cea8;\">5</span><span style=\"color: #d4d4d4;\">/</span><span style=\"color: #b5cea8;\">9</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">else</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\">&nbsp;(</span><span style=\"color: #9cdcfe;\">unit</span><span style=\"color: #d4d4d4;\">&nbsp;==
(5, 'Conversion de Distance', 'convertDistance', 'Convertis la longueur (distance) avec les unités allant de picomètre au Téramètre.', '/images/functions/convertDistance.png', 'form', '<p>Pour cette fonction on a un tableau de référence allant de pm à Tm :</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;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">correspondancesDistance</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;[</span><span style=\"color: #ce9178;\">\"pm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"nm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"µm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"mm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"cm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"dm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"m\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"dam\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"hm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"km\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"Mm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"Gm\"</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">null</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #ce9178;\">\"Tm\"</span><span style=\"color: #d4d4d4;\">];</span></div></div><p>Puis grâce à la différence des index des unités, on peut multiplier la valeur initiale par 10 puissance la différence :</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: #6a9955;\">/**&nbsp;</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@description</span><span style=\"color: #6a9955;\">&nbsp;Convertis&nbsp;la&nbsp;longueur&nbsp;(distance)&nbsp;avec&nbsp;les&nbsp;unités&nbsp;allant&nbsp;de&nbsp;picomètre&nbsp;au&nbsp;Téramètre.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@param</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #4ec9b0;\">{number}</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #9cdcfe;\">firstValue</span><span style=\"color: #6a9955;\">&nbsp;-&nbsp;Le&nbsp;nombre&nbsp;que&nbsp;vous&nbsp;voulez&nbsp;convertir</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><sp
(6, 'Générateur de citations', 'randomQuote', 'Génère aléatoirement une citation ou un proverbe.', '/images/functions/randomQuote.png', 'page', '<p>Même principe que la fonction randomNumber, on a une liste de citation contenu dans un tableau et on sélectionne un index au hasard dans ce tableau grâce à la fonction randomNumber, par exemple :</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;\">&nbsp;</span><span style=\"color: #dcdcaa;\">randomNumber</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">min</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">max</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #4ec9b0;\">Math</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">floor</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #4ec9b0;\">Math</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">random</span><span style=\"color: #d4d4d4;\">()&nbsp;*&nbsp;(</span><span style=\"color: #9cdcfe;\">max</span><span style=\"color: #d4d4d4;\">&nbsp;-&nbsp;</span><span style=\"color: #9cdcfe;\">min</span><span style=\"color: #d4d4d4;\">&nbsp;+</span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">))&nbsp;+&nbsp;</span><span style=\"color: #9cdcfe;\">min</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">}</span></div><div><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">quotes</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;[</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">quote:</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #ce9178;\">\"Deux&nbsp;choses&nbsp;sont&nbsp;infinies:&nbsp;l\'univers&nbsp;et&nbsp;la&nbsp;bêtise&nbsp;humaine;&nbsp;et&nbsp;je&nbsp;ne&nbsp;suis&nbsp;pas&nbsp;sûr&nbsp;de&nbsp;l\'univers.\"</span><span style=\"color: #d4d4d4;\">,</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">source:</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #ce9178;\">\"Albert&nbsp;Einstein\"</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">quote:</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #ce9178;\">\"Exige&nbsp;beaucoup&nbsp;de&nbsp;toi-même&nbsp;et&nbsp;attends&nbsp;peu&nbsp;des&nbsp;autres.&nbsp;Ainsi&nbsp;beaucoup&nbsp;d\'ennuis&nbsp;te&nbsp;seront&nbsp;épargnés.\"</span><span style=\"color: #d4d4d4;\">,</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">source:</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #ce9178;\">\"Confucius\"</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><div><span style=\"color: #d4d4d4;\">];</span></div><div><span style=\"color: #4ec9b0;\">console</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">log</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">quotes</span><span style=\"color: #d4d4d4;\">[</span><span style=\"
(7, 'Conversion de devise', 'convertCurrency', 'Convertis une valeur dans une devise dans une autre devise.', '/images/functions/convertCurrency.png', 'form', '<p>Les taux de changes sont récupérée grâce à l\"api : <a target=\"_blank\" href=\"https://api.exchangeratesapi.io\">https://api.exchangeratesapi.io</a></p><p>Pas plus compliqué qu\'une simple requête GET.</p>', '[{\"name\": \"number\", \"type\": \"float\", \"label\": \"Entrez le nombre à convertir :\", \"placeholder\": \"(e.g : 50)\"}, {\"name\": \"baseCurrency\", \"type\": \"select\", \"label\": \"La devise du nombre que vous voulez convertir :\", \"options\": [{\"name\": \"Euro (€) - EUR\", \"value\": \"EUR\"}, {\"name\": \"Livre sterling (£) - GBP\", \"value\": \"GBP\"}, {\"name\": \"Dollar Américain ($) - USD\", \"value\": \"USD\"}, {\"name\": \"Dollar Canadien ($) - CAD\", \"value\": \"CAD\"}, {\"name\": \"Dollar Australien ($) - AUD\", \"value\": \"AUD\"}, {\"name\": \"Peso Mexicain ($) - MXN\", \"value\": \"MXN\"}, {\"name\": \"Franc Suisse (Fr) - CHF\", \"value\": \"CHF\"}, {\"name\": \"Rouble Russe (₽) - RUB\", \"value\": \"RUB\"}, {\"name\": \"Réal brésilien (R$) - BRL\", \"value\": \"BRL\"}, {\"name\": \"Yen (¥) - JPY\", \"value\": \"JPY\"}]}, {\"name\": \"finalCurrency\", \"type\": \"select\", \"label\": \"Choisissez la devise que voulez avoir après conversion :\", \"options\": [{\"name\": \"Livre sterling (£) - GBP\", \"value\": \"GBP\"}, {\"name\": \"Dollar Américain ($) - USD\", \"value\": \"USD\"}, {\"name\": \"Dollar Canadien ($) - CAD\", \"value\": \"CAD\"}, {\"name\": \"Dollar Australien ($) - AUD\", \"value\": \"AUD\"}, {\"name\": \"Peso Mexicain ($) - MXN\", \"value\": \"MXN\"}, {\"name\": \"Franc Suisse (Fr) - CHF\", \"value\": \"CHF\"}, {\"name\": \"Rouble Russe (₽) - RUB\", \"value\": \"RUB\"}, {\"name\": \"Réal brésilien (R$) - BRL\", \"value\": \"BRL\"}, {\"name\": \"Yen (¥) - JPY\", \"value\": \"JPY\"}, {\"name\": \"Euro (€) - EUR\", \"value\": \"EUR\"}]}]', 1, '2019-09-13 00:00:00', '2020-05-08 13:47:42', 1),
(8, 'Conversion des Encodages de caractères', 'convertEncoding', 'Convertis des nombres de différentes bases et convertis en UTF-8.', '/images/functions/convertEncoding.png', 'form', NULL, '[{\"name\": \"value\", \"type\": \"text\", \"label\": \"Entrez votre valeur :\", \"placeholder\": \"Votre valeur...\"}, {\"name\": \"functionName\", \"type\": \"select\", \"label\": \"Choisissez une option :\", \"options\": [{\"name\": \"Décimal en Binaire\", \"value\": \"decimalToBinary\"}, {\"name\": \"Binaire en Décimal\", \"value\": \"binaryToDecimal\"}, {\"name\": \"Décimal en Hexadecimal\", \"value\": \"decimalToHexadecimal\"}, {\"name\": \"Hexadecimal en Décimal\", \"value\": \"hexadecimalToDecimal\"}, {\"name\": \"Binaire en Hexadécimal\", \"value\": \"binaryToHexadecimal\"}, {\"name\": \"Hexadécimal en Binaire\", \"value\": \"hexadecimalToBinary\"}, {\"name\": \"Chaque caractère a un nombre Unicode\", \"value\": \"textToNumberUnicode\"}, {\"name\": \"Chaque nombre Unicode a un caractère\", \"value\": \"numberUnicodeToText\"}, {\"name\": \"Texte en Binaire (UTF-8)\", \"value\": \"textToBinary\"}, {\"name\": \"Binaire (UTF-8) en Texte\", \"value\": \"binaryToText\"}, {\"name\": \"Texte en Hexadécimal (UTF-8)\", \"value\": \"textToHexadecimal\"}, {\"name\": \"Hexadécimal (UTF-8) en Texte\", \"value\": \"hexadecimalToText\"}], \"placeholder\": \"\"}]', 1, '2019-09-14 00:00:00', '2020-04-22 22:34:48', 2),
(9, 'Conversion d\'un nombre arabe en nombre romain', 'convertRomanArabicNumbers', 'Convertis un nombre arabe en nombre romain (et l\'inverse aussi).', '/images/functions/convertRomanArabicNumbers.png', 'form', NULL, '[{\"name\": \"value\", \"type\": \"text\", \"label\": \"Entrez votre nombre :\", \"placeholder\": \"(e.g : 50 ou L)\"}, {\"name\": \"functionName\", \"type\": \"select\", \"label\": \"Convertir en :\", \"options\": [{\"name\": \"Nombre Romain\", \"value\": \"convertArabicToRomanOutput\"}, {\"name\": \"Nombre Arabe\", \"value\": \"convertRomanToArabicOutput\"}], \"placeholder\": \"\"}]', 1, '2019-09-21 00:00:00', '2020-04-22 22:43:50', 2),
(10, 'Nombre d\'Armstrong', 'armstrongNumber', 'Permet de savoir si un nombre fait partie des nombres d\'Armstrong.', '/images/functions/armstrongNumber.png', 'form', NULL, '[{\"name\": \"number\", \"type\": \"integer\", \"label\": \"Entrez votre nombre :\", \"placeholder\": \"(e.g : 153)\"}]', 1, '2019-09-21 00:00:00', '2020-04-22 22:49:21', 2),
(11, 'Heap\'s algorithm', 'heapAlgorithm', 'Génère toutes les permutations uniques possibles d\'une chaîne de caractère.', '/images/functions/heapAlgorithm.png', 'form', NULL, '[{\"name\": \"string\", \"type\": \"text\", \"label\": \"Entrez un mot :\", \"placeholder\": \"(e.g : Mot)\"}]', 1, '2019-10-11 00:01:00', '2020-04-22 23:06:15', 2),
2020-04-28 18:48:16 +02:00
(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),
2020-04-29 18:51:30 +02:00
(14, 'Juste Prix', 'rightPrice', 'Arriverez-vous à deviner le prix d\'un objet ?', '/images/functions/rightPrice.png', 'page', NULL, NULL, 1, '2020-04-27 20:17:05', '2020-04-27 21: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);
INSERT INTO `functions` (`id`, `title`, `slug`, `description`, `image`, `type`, `article`, `utilizationForm`, `isOnline`, `createdAt`, `updatedAt`, `categorieId`) VALUES
(16, 'Les méthodes des tableaux', 'arrayMethods', 'Et si on refaisait les méthodes natives de l\'objet global \"Array\" ?', '/images/functions/arrayMethods.png', 'article', '<p><strong>JavaScript</strong> est un langage <strong>orienté objet</strong>, chaque type comme \"String\",&nbsp; \"Number\", ... sont en réalité des objets.&nbsp; <br>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nCe sont des \"<a target=\"_blank\" href=\"https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux\">Objets globaux</a>\", qui dispose de méthodes bien utiles. 😎&nbsp; Pourquoi je vous dit ça ?<br>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nCar aujourd\"hui nous allons reproduire les méthodes de l\"objet global \"<a target=\"_blank\" href=\"https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Array\">Array</a>\",&nbsp; 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\"on va appeler \"DivloArray\" par exemple et reproduire 6 méthodes (push, forEach, map, filter, reverse et join), bien évidemment libre à vous d\"en faire plus. 😊 Je vais expliquer le code une méthode après l\"autre donc bout de code par bout de code, si vous voulez avoir le code source complet, il est disponible sur ce <a target=\"_blank\" href=\"https://gist.github.com/Divlo/4ffc8ed007d293372ee449d2647fcad9\">GitHub Gist.</a><br>\n<br>\n\n\n\n\n\n\n\n\n\n\nDonc tout d\"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.)&nbsp;<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;\">&nbsp;</span><span style=\"color: #4ec9b0;\">DivloArray</span><span style=\"color: #d4d4d4;\">&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">constructor</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><div><span style=\"color: #d4d4d4;\">}</span></div><br>\n\n<div><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">divloArray</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #569cd6;\">new</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #4ec9b0;\">DivloArray</span><span style=\"color: #d4d4d4;\">([</span><span style=\"color: #b5cea8;\">57</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #b5cea8;\">4</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #b5cea8;\">2</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #b5cea8;\">8</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #b5cea8;\">16</span><span style=\"color: #d4d4d4;\">,&nbsp;</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\'écrire dans les deux sens (ex: kayak).', '/images/functions/isPalindrome.png', 'form', '<p>Pour réfléchir sur un problème, il faut le \"découper\" en petits autres problèmes, un palindrome est un mot qui peut s\"é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\"abord faire une fonction qui va retourner la chaîne de caractère à l\"envers, par exemple : \"Hello\" devient \"olleH.</p><p>Je vais vous montrer 2 techniques différentes pour arriver à écrire la fonction \"reverseString\" :</p><p>- 1ère méthode consiste à simplement faire une boucle à 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;\">&nbsp;</span><span style=\"color: #dcdcaa;\">reverseString</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #ce9178;\">\"\"</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">stringLength</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">length</span><span style=\"color: #d4d4d4;\">&nbsp;-&nbsp;</span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">for</span><span style=\"color: #d4d4d4;\">&nbsp;(</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">stringLength</span><span style=\"color: #d4d4d4;\">;&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">&nbsp;&gt;=&nbsp;</span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">;&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">--)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\">&nbsp;+=&nbsp;</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;\">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</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;\">&nbsp;</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, \'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;\">&nbsp;</span><span style=\"color: #dcdcaa;\">findLongestWord</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">string</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">arrayString</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</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;\">\"&nbsp;\"</span><span style=\"color: #d4d4d4;\">);</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">wordLength</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">wordResult</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #ce9178;\">\"\"</span><span style=\"color: #d4d4d4;\">;</span></div><br><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</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;\">)&nbsp;</span><span style=\"color: #569cd6;\">=&gt;</span><span style=\"color: #d4d4d4;\">&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\">&nbsp;(</span><span style=\"color: #9cdcfe;\">word</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">length</span><span style=\"color: #d4d4d4;\">&nbsp;&gt;&nbsp;</span><span style=\"color: #9cdcfe;\">wordLength</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">wordResult</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">word</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">wordLength</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</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;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;});</span></div><br><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</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, \'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;\">&nbsp;</span><span style=\"color: #dcdcaa;\">doSomeCode</span><span style=\"color: #d4d4d4;\">()&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</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, \'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;\">&nbsp;</span><span style=\"color: #dcdcaa;\">fibonacci</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;[],&nbsp;</span><span style=\"color: #9cdcfe;\">number1</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">number2</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\">&nbsp;(</span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\">&nbsp;===&nbsp;</span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">result</span><span style=\"color: #d4d4d4;\">;&nbsp;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\">--;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</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;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #dcdcaa;\">fibonacci</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">counter</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color
INSERT INTO `functions` (`id`, `title`, `slug`, `description`, `image`, `type`, `article`, `utilizationForm`, `isOnline`, `createdAt`, `updatedAt`, `categorieId`) VALUES
(20, 'Trie les éléments d\'un tableau', 'sortArray', 'Trie les éléments d\'un tableau dans l\'ordre croissant.', '/images/functions/sortArray.png', 'form', '<p>Le but ici c\"est de recevoir un tableau de nombres et de pouvoir remettre dans l\"ordre croissant le tableau (exemple : [4, 12, 1, 8] devient [1, 4, 8, 12]).</p><p>Comme je le dis souvent, il faut penser un problème en petits autres problèmes plus facilement atteignable. Pour commencer, je décide de faire une fonction qui me retourne le nombre le plus petit d\"un tableau.<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;\">function</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #dcdcaa;\">minNumber</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">minNumber</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;{&nbsp;</span><span style=\"color: #9cdcfe;\">index:</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">value:</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">[</span><span style=\"color: #b5cea8;\">0</span><span style=\"color: #d4d4d4;\">]&nbsp;};</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">for</span><span style=\"color: #d4d4d4;\">&nbsp;(</span><span style=\"color: #569cd6;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">;&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">&nbsp;&lt;&nbsp;</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">length</span><span style=\"color: #d4d4d4;\">;&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">++)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #51b6c4;\">number</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">[</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">];</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\">&nbsp;(</span><span style=\"color: #9cdcfe;\">number</span><span style=\"color: #d4d4d4;\">&nbsp;&lt;&nbsp;</span><span style=\"color: #9cdcfe;\">minNumber</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">value</span><span style=\"color: #d4d4d4;\">)&nbsp;{</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">minNumber</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;{&nbsp;</span><span style=\"color: #9cdcfe;\">index:</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">value:</span><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">[</span><span style=\"color: #9cdcfe;\">index</span><span style