function "call" CODE
If we call
driveCar()
function using
call()
function,
this
will refer to the object that will be passed. In this case:
john
object
let john = {
  firstName: 'John',
  lastName: 'Doe'
}

function driveCar() {
  document.write(this.firstName + ' ' + this.lastName + ' is driving a car<br/>')
}

driveCar.call(john)
by Valeri Tandilashvili
4 years ago
JavaScript
Function functions
1
Pro tip: use ```triple backticks around text``` to write in code fences