how to print certain elements of an array

The solution for “how to print certain elements of an array” can be found here. The following code will assist you in solving the problem.

var array = [‘a’,’b’,’c’,’d’,’e’,’f’,’g’]

for(var i = 0; i < array.length ; i++){ if ((array[i] != 'b') && (array[i] != 'f')){ console.log(array[i]) } } /* if statement and u need && and number of statements needs same number of () every letter needs own statement and != means not */

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in