## Find all the prime factors for the given number

Input : A number // 10 Output : An array // [2, 5] Logic : Key here is that we need to check the divisor starting with 2 to the square root of the...

Skip to content# Monthly Archive: September 2015

## Find all the prime factors for the given number

## Transform json to json

## Check if an element exists in an array, based on that update an array

## Determine character frequency in the given string

## Convert the given array of elements to a string

## Remove duplicates from the given array

## Filter and sort the given array

## Determine if a number is Odd or not

## Fibonacci sum for the given number

## Calculate the average of a nested array

Input : A number // 10 Output : An array // [2, 5] Logic : Key here is that we need to check the divisor starting with 2 to the square root of the...

Problem description : Write a function which transforms the given JSON as shown belows : Input : Given an endorsment array with objects containing skill and user keys var endorsements = [ { skill:...

Problem description : Write a function which detects if the given element exists in an array or not. If it does not exist then adds it to an array If it does exist then...

Problem description : Create a character frequency analysis table for the given string. Input : A string // “foo bar” Output : A JSON // {” “: 1, a: 1, b: 1, f: 1,...

Problem description : Write a function that converts a given array into a string. Input : An Array Output : A String Logic : Iterate through array concatenate the new element into the string...

Problem description : Write a function that removes duplicates entries from a given array. Input : An Array // [‘Heart5’, ‘Diamond6’, ‘Club7’, ‘Spade8’, ‘Diamond6’, ‘Club7’] Output : An Array // [‘Heart5’, ‘Diamond6’, ‘Club7’, ‘Spade8’]...

Problem description : Write a function that filters the invalid entries from the given array by removing the following elements : which does not have either id or extension property whose id value is...

Problem description : Write a method to determine the given number is odd or not. If it’s not a number then throw an error. Add this method as native javascript method. Input : A...

Problem description : In mathematics, the Fibonacci numbers are the numbers in the following integer sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, … In mathematical terms, the...

Problem description: The following nested array contains some invalid entries (which are not numbers). We also want to filter those entries in our average calculation. var nestedArray = [ 1, 2, 3, [4, 5,...