1.9 KiB
1.9 KiB
id, title, challengeType, forumTopicId
id | title | challengeType | forumTopicId |
---|---|---|---|
587d7dac367417b2b2512b73 | Create a Basic JavaScript Object | 1 | 301317 |
Description
duck
object:
let duck = {
name: "Aflac",
numLegs: 2
};
This duck
object has two property/value pairs: a name
of "Aflac" and a numLegs
of 2.
Instructions
dog
object with name
and numLegs
properties, and set them to a string and a number, respectively.
Tests
tests:
- text: <code>dog</code> should be an object.
testString: assert(typeof(dog) === 'object');
- text: <code>dog</code> should have a <code>name</code> property set to a <code>string</code>.
testString: assert(typeof(dog.name) === 'string');
- text: <code>dog</code> should have a <code>numLegs</code> property set to a <code>number</code>.
testString: assert(typeof(dog.numLegs) === 'number');
Challenge Seed
let dog = {
};
Solution
let dog = {
name: '',
numLegs: 4
};