Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/js-fundamentals-objects.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,50 @@
const person = { age: 32, size: 'Small' }

// 1. Give the person object a name property with the value Matt
person.name='Matt'


// 2. Remove the size property from the person
delete person.size


// 3. Increase the person's age by 11
person.age+=11

// 4. Add an instruments property to the person, initialised as an empty array
person.instruments=[]


// 5. Add the following instruments to the persons instruments array: Guitar, Piano, Vocals
person.instruments.push('Guitar', 'Piano','Vocals')

// 6. Using an index on the instruments array, set the mainInstrument variable below
// to the third instrument in the array
const mainInstrument = undefined
const mainInstrument = person.instruments[2]


// 7. Add a profession property to the person, which is an object
person.profession={}

// 8. Add a name property to the profession object with the value Musician
person.profession.name='Musician'

// 9. Add a friends property to the person, which is an empty array
person.friends=[]

// 10. Add two objects to the persons friends array with the following properties:
// Friend one: name - Chris, age - 46
// Friend two: name - Dom, age - 43

person.friends.push({name:'Chris', age: 46}, {name:'Dom', age: 43})

// 11. Using an index on the persons friends array, set the bestFriend variable below
// to the name of the first friend in the array
const bestFriend = undefined
const bestFriend = person.friends[0].name

// Don't change the code below this line
module.exports = {
person,
mainInstrument,
bestFriend
}
}
21 changes: 16 additions & 5 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ const book = {
}

/* eslint-disable no-unused-vars */
const isbn13 = '978-0132350884'
book.isbn.isbn13 = '978-0132350884'

// 1. Set this to the book name - using the book object
const name = ''
book.category = 'Programming'
book.pages = 464
delete book.dimensions
delete book.isbn.asin
book.isbn.isbn10 = '9780132350884'
const name = book.name

// 2. Set this to the isbn 10 value - using the book object
const isbn10 = ''
const isbn10 = book.isbn.isbn10

// Do not modify this basket object directly
const basket = {
Expand All @@ -42,10 +47,16 @@ const basket = {
}

// 3. Set this variable to the length of the baskets voucher codes array - using the basket object
const numberOfVoucherCodes = null
basket.items[0].price = 2
basket.items.push({
name: 'Oranges',
quantity: 4,
price: 0.75
})
const numberOfVoucherCodes = basket.voucherCodes.length

// 4. Set this variable to the first element in of the baskets voucher codes array - using the basket object
const firstVoucherCode = null
const firstVoucherCode = basket.voucherCodes[0]

// Do not edit this exported object
module.exports = {
Expand Down