TCS vuejs interview
1. let arr = [1,2,2,3,4,1,5,2] // [1,2,3,4,5] Remove duplicates // // function removeDuplicate(arr){ // // return [...new Set(arr)] // // } // // console.log( removeDuplicate([1,2,2,3,4,1,5,2])) 2. let str = 'dl roWyM' //'My World' 3. const row1 = ['Black', 'Black', 'Green', 'Pink']; const row2 = ['Black', 'Yellow', 'Pink', 'White']; const row3 = ['Green', 'Orange', 'Black', 'White']; const row4 = ['Red', 'White', 'Yellow', 'Pink']; // How many clusters of any given color & what is the cluster size of it? // Expected Answer: Black: 3, Pink: 2, White: 2