/* 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', NULL, '[{\"name\": \"cityName\", \"type\": \"text\", \"label\": \"Entrez le nom d\'une ville :\", \"placeholder\": \"(e.g : Paris, FR)\"}]', 1, '2019-08-16 00:00:00', '2020-04-16 17:34:49', 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', NULL, '[{\"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-04-21 14:43:40', 2),
(3, 'Quel âge avez-vous ?', 'calculateAge', 'Calcule l\'âge selon la date de naissance.', '/images/functions/calculateAge.png', 'form', NULL, '[{\"name\": \"birthDate\", \"type\": \"calendar\", \"label\": \"Entrez la date de naissance au format (dd/mm/yyyy) :\", \"placeholder\": \"Sélectionnez une date\"}]', 1, '2019-08-16 00:00:00', '2020-04-17 16:54:27', 1),
(4, 'Conversion de Température', 'convertTemperature', 'Convertis des Degré Celsius en Degré Fahrenheit et l\'inverse aussi.', '/images/functions/convertTemperature.png', 'form', NULL, '[{\"name\": \"degree\", \"type\": \"float\", \"label\": \"Entrez la température\", \"placeholder\": \"(e.g : 23)\"}, {\"name\": \"unitToConvert\", \"type\": \"select\", \"label\": \"Convertir en : \", \"options\": [{\"name\": \"Degré Celsius (°C)\", \"value\": \"°C\"}, {\"name\": \"Degré Fahrenheit (°F)\", \"value\": \"°F\"}], \"placeholder\": \"\"}]', 1, '2019-08-16 00:00:00', '2020-04-21 16:52:11', 1),
(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', NULL, '[{\"name\": \"number\", \"type\": \"float\", \"label\": \"Entrez la distance que vous voulez convertir :\", \"placeholder\": \"(e.g : 50)\"}, {\"name\": \"numberUnit\", \"type\": \"select\", \"label\": \"L\'unité du nombre que vous voulez convertir : \", \"options\": [{\"name\": \"Picomètre (pm)\", \"value\": \"pm\"}, {\"name\": \"Nanomètre (nm)\", \"value\": \"nm\"}, {\"name\": \"Micromètre (µm)\", \"value\": \"µm\"}, {\"name\": \"Millimètre (mm)\", \"value\": \"mm\"}, {\"name\": \"Centimètre (cm)\", \"value\": \"cm\"}, {\"name\": \"Décimètre (dm)\", \"value\": \"dm\"}, {\"name\": \"Mètre (m)\", \"value\": \"m\"}, {\"name\": \"Décamètre (dam)\", \"value\": \"dam\"}, {\"name\": \"Hectomètre (hm)\", \"value\": \"hm\"}, {\"name\": \"Kilomètre (km)\", \"value\": \"km\"}, {\"name\": \"Mégamètre (Mm)\", \"value\": \"Mm\"}, {\"name\": \"Gigamètre (Gm)\", \"value\": \"Gm\"}, {\"name\": \"Téramètre (Tm)\", \"value\": \"Tm\"}], \"placeholder\": \"\"}, {\"name\": \"finalUnit\", \"type\": \"select\", \"label\": \"Choisissez l\'unité que vous voulez avoir après conversion :\", \"options\": [{\"name\": \"Picomètre (pm)\", \"value\": \"pm\"}, {\"name\": \"Nanomètre (nm)\", \"value\": \"nm\"}, {\"name\": \"Micromètre (µm)\", \"value\": \"µm\"}, {\"name\": \"Millimètre (mm)\", \"value\": \"mm\"}, {\"name\": \"Centimètre (cm)\", \"value\": \"cm\"}, {\"name\": \"Décimètre (dm)\", \"value\": \"dm\"}, {\"name\": \"Mètre (m)\", \"value\": \"m\"}, {\"name\": \"Décamètre (dam)\", \"value\": \"dam\"}, {\"name\": \"Hectomètre (hm)\", \"value\": \"hm\"}, {\"name\": \"Kilomètre (km)\", \"value\": \"km\"}, {\"name\": \"Mégamètre (Mm)\", \"value\": \"Mm\"}, {\"name\": \"Gigamètre (Gm)\", \"value\": \"Gm\"}, {\"name\": \"Téramètre (Tm)\", \"value\": \"Tm\"}], \"placeholder\": \"\"}]', 1, '2019-08-16 00:00:00', '2020-04-27 16:16:42', 1),
(6, 'Générateur de citations', 'randomQuote', 'Génère aléatoirement une citation ou un proverbe.', '/images/functions/randomQuote.png', 'page', NULL, NULL, 1, '2019-09-13 00:00:00', '2020-04-22 10:23:43', 1),
(7, 'Conversion de devise', 'convertCurrency', 'Convertis une valeur dans une devise dans une autre devise.', '/images/functions/convertCurrency.png', 'form', NULL, '[{\"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-04-22 21:55:30', 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),
(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\'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),
(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\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\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\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\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(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- 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: normal;font-size: 14px;line-height: 19px;white-space: pre;\"><div><span style=\"color: #6a9955;\">/**</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@description</span><span style=\"color: #6a9955;\">&nbsp;Ajoute&nbsp;un&nbsp;ou&nbsp;plusieurs&nbsp;éléments&nbsp;à&nbsp;la&nbsp;fin&nbsp;d\"un&nbsp;tableau&nbsp;et&nbsp;retourne&nbsp;la&nbsp;nouvelle&nbsp;taille&nbsp;du&nbsp;tableau.</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;\">{*}</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #9cdcfe;\">elements</span><span style=\"color: #6a9955;\">&nbsp;Éléments&nbsp;à&nbsp;ajoutés</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;\">{Number}</span><span style=\"color: #6a9955;\">&nbsp;La&nbsp;taille&nbsp;(length)&nbsp;du&nbsp;nouveau&nbsp;tableau</span></div><div><span style=\"color: #6a9955;\">&nbsp;*/</span></div><div><span style=\"color: #dcdcaa;\">push</span><span style=\"color: #d4d4d4;\">(...</span><span style=\"color: #9cdcfe;\">elements</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;\">indexCourant</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</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;\">length</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #9cdcfe;\">elements</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">forEach</span><span style=\"color: #d4d4d4;\">((</span><span style=\"color: #9cdcfe;\">element</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: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">[</span><span style=\"color: #9cdcfe;\">indexCourant</span><span style=\"color: #d4d4d4;\">]&nbsp;=&nbsp;</span><span style=\"color: #9cdcfe;\">element</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;\">indexCourant</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: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">array</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><p>Alors on prend en paramètre des éléments avec le spread operator ce qui nous permet d\"obtenir un tableau (exemple: 1, 2, 3 devient [1, 2, 3]). On fait une variable indexCourant qui est égale à la taille du tableau qu\"on incrémentera de 1 à chaque tour de boucle, comme ça on peut accéder à l\"index qui n\"existe pas encore et lui attribuer une valeur, l\"élement en cours de la boucle, si vous avez des questions n\"hésitez pas à les poster en commentaire.<br>\n<br>\n\n\n\n\n\n- La méthode <strong>forEach :&nbsp;</strong></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;\">/**</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@description</span><span style=\"color: #6a9955;\">&nbsp;Permet&nbsp;d\"exécuter&nbsp;une&nbsp;fonction&nbsp;donnée&nbsp;sur&nbsp;chaque&nbsp;élément&nbsp;du&nbsp;tableau.&nbsp;</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;\">{Function}</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #9cdcfe;\">callback</span><span style=\"color: #6a9955;\">&nbsp;Une&nbsp;fonction&nbsp;qui&nbsp;accepte&nbsp;jusqu\"à&nbsp;trois&nbsp;arguments&nbsp;:</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;valeurCourante&nbsp;→&nbsp;La&nbsp;valeur&nbsp;de&nbsp;l\"élément&nbsp;du&nbsp;tableau&nbsp;en&nbsp;cours&nbsp;de&nbsp;traitement.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;index&nbsp;→&nbsp;L\"indice&nbsp;de&nbsp;l\"élément&nbsp;du&nbsp;tableau&nbsp;en&nbsp;cours&nbsp;de&nbsp;traitement.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;array&nbsp;→&nbsp;Le&nbsp;tableau&nbsp;sur&nbsp;lequel&nbsp;la&nbsp;méthode&nbsp;forEach&nbsp;est&nbsp;appliquée.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*/</span></div><div><span style=\"color: #dcdcaa;\">forEach</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">callback</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;\">0</span><span style=\"color: #d4d4d4;\">;&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">&nbsp;&lt;&nbsp;</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;\">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: #9cdcfe;\">valeurCourante</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</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;\">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: #dcdcaa;\">callback</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">valeurCourante</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</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></div><p>Prend une fonction callback, c\"est à dire une fonction qui va être exécutée dans le corps de la fonction et on fait une simple boucle for.<br>\n<br>\n\n\n\n\n- La méthode <strong>map</strong>&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: #6a9955;\">/**</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@description</span><span style=\"color: #6a9955;\">&nbsp;Crée&nbsp;un&nbsp;nouveau&nbsp;tableau&nbsp;avec&nbsp;les&nbsp;résultats&nbsp;de&nbsp;l\"appel&nbsp;d\"une&nbsp;fonction&nbsp;fournie&nbsp;sur&nbsp;chaque&nbsp;élément&nbsp;du&nbsp;tableau&nbsp;appelant.</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;\">{Function}</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #9cdcfe;\">callback</span><span style=\"color: #6a9955;\">&nbsp;Une&nbsp;fonction&nbsp;qui&nbsp;accepte&nbsp;jusqu\"à&nbsp;trois&nbsp;arguments.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;valeurCourante&nbsp;→&nbsp;La&nbsp;valeur&nbsp;de&nbsp;l\"élément&nbsp;du&nbsp;tableau&nbsp;en&nbsp;cours&nbsp;de&nbsp;traitement.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;index&nbsp;→&nbsp;L\"indice&nbsp;de&nbsp;l\"élément&nbsp;du&nbsp;tableau&nbsp;en&nbsp;cours&nbsp;de&nbsp;traitement.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;array&nbsp;→&nbsp;Le&nbsp;tableau&nbsp;sur&nbsp;lequel&nbsp;la&nbsp;méthode&nbsp;est&nbsp;appliquée.</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;\">{Array}</span><span style=\"color: #6a9955;\">&nbsp;Un&nbsp;nouveau&nbsp;tableau&nbsp;composé&nbsp;des&nbsp;images&nbsp;de&nbsp;la&nbsp;fonction&nbsp;de&nbsp;rappel.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*/</span></div><div><span style=\"color: #dcdcaa;\">map</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">callback</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: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">&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;</span><span style=\"color: #6a9955;\">//&nbsp;permet&nbsp;de&nbsp;ne&nbsp;pas&nbsp;changer&nbsp;les&nbsp;valeurs&nbsp;du&nbsp;tableau&nbsp;original&nbsp;(car&nbsp;passage&nbsp;par&nbsp;référence)</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">forEach</span><span style=\"color: #d4d4d4;\">((</span><span style=\"color: #9cdcfe;\">elementCourant</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">indexCourant</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: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">[</span><span style=\"color: #9cdcfe;\">indexCourant</span><span style=\"color: #d4d4d4;\">]&nbsp;=&nbsp;</span><span style=\"color: #dcdcaa;\">callback</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">elementCourant</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">indexCourant</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</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;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">array</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">}</span></div></div><p><br>\n\n\n\n- La méthode <strong>filter</strong> :&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: #6a9955;\">/**</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@description</span><span style=\"color: #6a9955;\">&nbsp;Retourne&nbsp;un&nbsp;nouveau&nbsp;tableau&nbsp;contenant&nbsp;tous&nbsp;les&nbsp;éléments&nbsp;du&nbsp;tableau&nbsp;d\"origine&nbsp;qui&nbsp;remplissent&nbsp;une&nbsp;condition&nbsp;déterminée&nbsp;par&nbsp;la&nbsp;fonction&nbsp;callback.</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;\">{Function}</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #9cdcfe;\">callback</span><span style=\"color: #6a9955;\">&nbsp;La&nbsp;fonction&nbsp;de&nbsp;test&nbsp;à&nbsp;appliquer&nbsp;à&nbsp;chaque&nbsp;élément&nbsp;du&nbsp;tableau.&nbsp;Cette&nbsp;fonction&nbsp;est&nbsp;appelée&nbsp;avec&nbsp;les&nbsp;arguments&nbsp;suivants&nbsp;:</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;elementCourant&nbsp;→&nbsp;L\"élément&nbsp;à&nbsp;traiter</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;index&nbsp;→&nbsp;Son&nbsp;indice</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;-&nbsp;array&nbsp;→&nbsp;Le&nbsp;tableau&nbsp;complet</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;\">{Array}</span><span style=\"color: #6a9955;\">&nbsp;Un&nbsp;nouveau&nbsp;tableau&nbsp;contenant&nbsp;les&nbsp;éléments&nbsp;qui&nbsp;respectent&nbsp;la&nbsp;condition&nbsp;du&nbsp;filtre.&nbsp;Si&nbsp;aucun&nbsp;élément&nbsp;ne&nbsp;respecte&nbsp;la&nbsp;condition,&nbsp;c\"est&nbsp;un&nbsp;tableau&nbsp;vide&nbsp;qui&nbsp;est&nbsp;renvoyé.</span></div><div><span style=\"color: #6a9955;\">&nbsp;*/</span></div><div><span style=\"color: #dcdcaa;\">filter</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">callback</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: #9cdcfe;\">resultArray</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;[];</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">forEach</span><span style=\"color: #d4d4d4;\">((</span><span style=\"color: #9cdcfe;\">elementCourant</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">indexCourant</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: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">isTrue</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #dcdcaa;\">callback</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">elementCourant</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">indexCourant</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">array</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;\">isTrue</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;\">resultArray</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">push</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">elementCourant</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><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;\">resultArray</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">}</span></div></div><p>Comme on peut le voir beaucoup de ces méthodes recoivent une fonction callback, en tout cas, cette méthode ressemble beaucoup à la méthode map sauf que cette fois çi à la place de faire une assignation on vérifie si la callback nous renvoie True et si oui on push l\"élément à notre tableau de résultats.<br>\n<br>\n\n- La méthode <strong>reverse</strong> qui inverse le tableau :&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: #6a9955;\">/**</span></div><div><span style=\"color: #6a9955;\">&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@description</span><span style=\"color: #6a9955;\">&nbsp;Transpose&nbsp;les&nbsp;éléments&nbsp;d\"un&nbsp;tableau&nbsp;:&nbsp;le&nbsp;premier&nbsp;élément&nbsp;devient&nbsp;le&nbsp;dernier&nbsp;et&nbsp;le&nbsp;dernier&nbsp;devient&nbsp;le&nbsp;premier&nbsp;et&nbsp;ainsi&nbsp;de&nbsp;suite.</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;\">{Array}</span><span style=\"color: #6a9955;\">&nbsp;Le&nbsp;tableau&nbsp;inversé</span></div><div><span style=\"color: #6a9955;\">&nbsp;*/</span></div><div><span style=\"color: #dcdcaa;\">reverse</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: #9cdcfe;\">reverseArray</span><span style=\"color: #d4d4d4;\">&nbsp;=&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: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #9cdcfe;\">array</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;\">;&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: #569cd6;\">const</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">element</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</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;\">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: #9cdcfe;\">reverseArray</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">push</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">element</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;\">reverseArray</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">}</span></div></div><p>On fait l\"inverse de la méthode forEach, à la place de commencer l\"index à 0 et de l\"incrémenter par 1, cette fois çi on commence par le nombre d\"éléments dans le tableau - 1, et on enlève 1 à chaque tour de boucle.<br>\n<br>\n- Et pour finir la méthode <strong>join</strong> :</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: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #6a9955;\">/**</span></div><div><span style=\"color: #6a9955;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Crée&nbsp;et&nbsp;renvoie&nbsp;une&nbsp;nouvelle&nbsp;chaîne&nbsp;de&nbsp;caractères&nbsp;en&nbsp;concaténant&nbsp;tous&nbsp;les&nbsp;éléments&nbsp;d\'un&nbsp;tableau</span></div><div><span style=\"color: #6a9955;\">&nbsp;&nbsp;&nbsp;&nbsp;&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;\">separator</span><span style=\"color: #6a9955;\">&nbsp;Ce&nbsp;paramètre&nbsp;optionnel&nbsp;indique&nbsp;une&nbsp;chaine&nbsp;de&nbsp;caractères&nbsp;pour&nbsp;séparer&nbsp;chaque&nbsp;élément&nbsp;du&nbsp;tableau</span></div><div><span style=\"color: #6a9955;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span style=\"color: #569cd6;\">@returns</span><span style=\"color: #6a9955;\">&nbsp;</span><span style=\"color: #4ec9b0;\">{String}</span><span style=\"color: #6a9955;\">&nbsp;Une&nbsp;chaîne&nbsp;de&nbsp;caractères&nbsp;composée&nbsp;de&nbsp;tous&nbsp;les&nbsp;éléments&nbsp;du&nbsp;tableau&nbsp;joints&nbsp;les&nbsp;uns&nbsp;aux&nbsp;autres.</span></div><div><span style=\"color: #6a9955;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #dcdcaa;\">join</span><span style=\"color: #d4d4d4;\">(</span><span style=\"color: #9cdcfe;\">separator</span><span style=\"color: #d4d4d4;\">&nbsp;=&nbsp;</span><span style=\"color: #ce9178;\">\",\"</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;\">let</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">resultString</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;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #569cd6;\">this</span><span style=\"color: #d4d4d4;\">.</span><span style=\"color: #dcdcaa;\">forEach</span><span style=\"color: #d4d4d4;\">((</span><span style=\"color: #9cdcfe;\">element</span><span style=\"color: #d4d4d4;\">,&nbsp;</span><span style=\"color: #9cdcfe;\">index</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;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">if</span><span style=\"color: #d4d4d4;\">&nbsp;(</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;\">length</span><span style=\"color: #d4d4d4;\">&nbsp;-&nbsp;</span><span style=\"color: #b5cea8;\">1</span><span style=\"color: #d4d4d4;\">&nbsp;===&nbsp;</span><span style=\"color: #9cdcfe;\">index</span><span style=\"color: #d4d4d4;\">)&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">resultString</span><span style=\"color: #d4d4d4;\">&nbsp;+=&nbsp;</span><span style=\"color: #9cdcfe;\">element</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;\">resultString</span><span style=\"color: #d4d4d4;\">&nbsp;+=&nbsp;</span><span style=\"color: #9cdcfe;\">element</span><span style=\"color: #d4d4d4;\">&nbsp;+&nbsp;</span><span style=\"color: #9cdcfe;\">separator</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;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #c586c0;\">return</span><span style=\"color: #d4d4d4;\">&nbsp;</span><span style=\"color: #9cdcfe;\">resultString</span><span style=\"color: #d4d4d4;\">;</span></div><div><span style=\"color: #d4d4d4;\">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></div><p>Juste petite subtilité, on ne doit pas rajouter le séparateur à la dernière itrération de la boucle et donc pour ça on fait une simple condition.<br><br>Alors ? Ce n\'est pas très compliqué, mais je trouve c\'est important de comprendre comment les méthodes/fonctions fonctionnent avant de s\'en servir et savoir les refaire c\'est toujours un bon plus même si en réalité dans un projet on ne va juste utiliser ces méthodes sans réfléchir comment elles fonctionnent.</p>', NULL, 1, '2020-04-29 20:16:09', '2020-04-29 21:19:49', 4);