Skip to content
Permalink
Browse files
  • Loading branch information
kluzikp committed Oct 10, 2019
2 parents b2acfd4 + da44337 commit e8a00a7857accb69b759d414f95b92cf202b2daf
Showing 1 changed file with 19 additions and 5 deletions.
@@ -6,20 +6,34 @@
const employee = {
firstName: 'Colin',
'last name': 'Stephen',
department: "Computing",
startYear: 2010,
getName: () => `${this.firstName} ${this['last name']}`,
setName: function(fullname) {
console.log(fullname)
//console.log(fullname)
const words = fullname.toString().split(' ')
console.log(words)
console.log(this)
//console.log(words)
//console.log(this)
this.firstName = words[0] || ''
this['last name'] = words[1] || ''
}
}

const jsonString = JSON.stringify(employee, null, 2)
console.log(jsonString)
employee.grade = 4
employee['currently employed'] = true
employee.department = 'Computer Science'

delete employee.department


console.log(JSON.stringify(employee, null, 2))

employee.setName('Micky Mouse')

console.log(JSON.stringify(employee, null, 2))
const name = employee.getName()

const jsonString = JSON.stringify(employee, null, 2)
console.log(jsonString)


0 comments on commit e8a00a7

Please sign in to comment.