Coding Challenge: List of Words

Let's take a few words as input and create a method of an object to store words in the array.

Problem statement

Here, you will practice on objects and use functions to play with arrays. You will take a few words in the array and output the particular words according to the below tasks.

First, you will define an object and create a method to perform this functionality.

Task 1

Create an object that contains the following properties:

  • list: array to store words
  • addWord(word) : function to add given word in list array except the words ending with ing

Input

addWord("Hello");
addWord("World");
addWord("Working");
addWord("London");

Expected output

list = ["Hello","World","London"]

Coding exercise

Get hands-on with 1200+ tech skills courses.