Share your repls and programming experiences

← Back to all posts
Overthinking this, somebody help!
jj3185

let listOfPuppies = ['shadow', 'mocha', 'ranger']
let puppyAges = [0, 1, 2]

// access puppyAges at the right index to find shadow's age
puppyAges[0]

// mocha had a birthday! update her age to 2 in puppyAges
puppyAges[1] = 2

// There's a new puppy called 'holly' - add her to listOfPuppies
listOfPuppies = ['shadow', 'mocha', 'ranger', 'holly']

// don't forget to add holly's age (0) to the puppyAges array
puppyAges

Voters
ExtremeEdge007
jj3185
Comments
hotnewtop
ExtremeEdge007

solution:

let listOfPuppies = ["shadow", "mocha", "ranger"];
let puppyAges = [0, 1, 2];

// access puppyAges at the right index to find shadow's age
let shadowAge = puppyAges[0];

// mocha had a birthday! update her age to 2 in puppyAges
puppyAges[1];
puppyAges[1]=2;
puppyAges[1];
// There's a new puppy called 'holly' - add her to listOfPuppies
listOfPuppies [3] = "holly";

// don't forget to add holly's age (0) to the puppyAges array
puppyAges[3] = 0;

// This tests your code - you can ignore it for now!
require('./test.js');(void 0);