scrimba
Frontend Career Path
Essential JavaScript concepts
JS Mini Projects
Constructor Function Challenge
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Constructor Function Challenge
AboutCommentsNotes
Constructor Function Challenge
Expand for more info
index.js
run
preview
console
/*
Challenge:
1. Create a constructor function called 'Character'.
2. Give it 'name' and 'collectedItemsArr' properties.
- 'name' should hold the character’s name.
- 'collectedItemsArr' should hold an array of items.
Initialise it to an empty array.
3. Create an 'addItem' method which takes in an item as
a parameter and adds it to 'collectedItemsArr'.
4. The addItem method should log out a sentence like
`Merlin now has: wand, map, potion`.
5. Check it’s working by creating several instances of
Character and adding items to their arrays.
*/
Console
/index.html
-5:17