Headings from h1
through h6
are constructed with a #
for each level:
# h1 Heading
## h2 Heading
### h3 Heading
(function(){ | |
console.log("Anonymous function invocation"); | |
console.log(this === window); | |
})(); | |
// Prints true on console |
function foo () { | |
'use strict'; | |
console.log("Simple function call") | |
console.log(this === window); | |
} | |
foo(); //prints false on console as in “strict mode” value of “this” in global execution context is undefined. |
function Person(fn, ln) { | |
this.first_name = fn; | |
this.last_name = ln; | |
this.displayName = function() { | |
console.log(`Name: ${this.first_name} ${this.last_name}`); | |
} | |
} | |
let person = new Person("John", "Reed"); |
function Person(fn, ln) { | |
this.first_name = fn; | |
this.last_name = ln; | |
this.displayName = function() { | |
console.log(`Name: ${this.first_name} ${this.last_name}`); | |
} | |
} | |
let person = new Person("John", "Reed"); |
function Person(fn, ln) { | |
this.first_name = fn; | |
this.last_name = ln; | |
this.displayName = function() { | |
console.log(`Name: ${this.first_name} ${this.last_name}`); | |
} | |
} | |
let person = new Person("John", "Reed"); |
function multiply(p, q, callback) { | |
callback(p * q); | |
} | |
let user = { | |
a: 2, | |
b:3, | |
findMultiply: function() { | |
multiply(this.a, this.b, function(total) { | |
console.log(total); |
var count = 5; | |
function test () { | |
console.log(this.count === 5); | |
} | |
test() // Prints true as “count” variable declaration happened in global execution context so count will become part of global object. |
import { Contact } from './contact'; | |
describe('Contact', () => { | |
it('should create an instance', () => { | |
expect(new Contact()).toBeTruthy(); | |
}); | |
it('should accept values from constructor', () => { | |
let contact = new Contact({ | |
firstName: 'John', |
import { TestBed, inject } from '@angular/core/testing'; | |
import { AddressBookDataService } from './address-book-data.service'; | |
import { Contact } from '../models/contact'; | |
describe('AddressBookDataService', () => { | |
beforeEach(() => { | |
TestBed.configureTestingModule({ | |
providers: [AddressBookDataService] | |
}); |