Exercise 3: JavaScript Problem Solving

Exercise 1

Write a JavaScript program to print out all even numbers from a given Array in the same order and stop printing when it finds 237 in the sequence.

Sample numbers list:

let numbers = [
386,
462,
47,
418,
907,
344,
236,
375,
823,
566,
597,
978,
328,
615,
953,
345,
399,
162,
758,
219,
918,
237,
412,
566,
826,
248,
866,
950,
626,
949,
687,
217,
815,
67,
104,
58,
512,
24,
892,
894,
767,
553,
81,
379,
843,
831,
445,
742,
717,
958,
743,
527,
];

Exercise 2

Given an Array of numbers and a number k, write a JavaScript program to check whether the sum of any two numbers from the list is equal to k or not.

For example, given [1, 5, 11, 5] and k = 16, return true since 11 + 5 is 16.

Exercise 3

Write a JavaScript program to compute the largest product of three integers from a given list of integers.

Exercise 4

Write a JavaScript program to multiply all the items in a list by the same value

Exercise 5

Write a JavaScript program to multiply all the items in a list together

Exercise 6

Write a JavaScript program to find the list of words that are longer than n from a given string.

Next: Objects

Previous: Arrays