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().