From 9dfae2a543e782587a06c6db9af395e66821817e Mon Sep 17 00:00:00 2001 From: mandar625 <86163301+mandar625@users.noreply.github.com> Date: Fri, 25 Nov 2022 19:35:19 +0530 Subject: [PATCH] Update js codes.docx --- js codes.docx | 1 + 1 file changed, 1 insertion(+) diff --git a/js codes.docx b/js codes.docx index e294ee2..00c9cf8 100644 --- a/js codes.docx +++ b/js codes.docx @@ -28,6 +28,7 @@ console.log(unique.length) //output: 10 Code 3: Remove Duplicate characters from array of element using filter var myArray = ['a', 1, 'a', 2, '1']; var unique = myArray.filter((value, index, arr) => arr.indexOf(value) === index); +// can be done using set also var unique = [...new Set(arr)] ================================================================================================================================================================================ Code 4:String reverse without reversing of individual words (Array of elements can be reverse with reverse() method but for string it is won't possible so required to split and then join().