Question 1

Given an string print the characters with their number of occurrences?
Input: aaccceezzzzqaaa
Output: a2c3e2z4q1a3

Question 2

How would you remove duplicate members from an array?
Input : [1, 1, 3, 5, 8, 7, 3, 8, 99]
Output : [1,5,7,3,8,99]

Question 3

Write a JavaScript program to sort the items of an array.
Input : [1, 4, 2, 5, 6, 7, 3, 8, 99]
Output : [1,2,3,4,5,6,7,8,99]

Question 4

print ping pong alternatively in JavaScript
Input: 2 (number of occurrences)
Output : ping pong

Question 5

How would you reverse a string in JavaScript?
Input: reverse
Output: esrever