This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Hello ui-router</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body ng-app="HelloWorld"> | |
<header> | |
<nav> | |
<ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface StackConstructor<T> { | |
new <T>(n: number): Stack<T> | |
} | |
export class Stack<T>{ | |
private data: T[] = []; | |
static readonly OVERFLOW = 'OVERFLOW'; | |
static readonly UNDERFLOW = 'UNDERFLOW'; | |
constructor(private size: number) { | |
} | |
push(item: T): number | string { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IComponentLoader { | |
data: any; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove Duplicates from an array | |
const removeDuplicates = | |
arr => arr.filter((item, index) => index === arr.indexOf(item)); | |
const removeDuplicates1 = array => [...new Set(array)]; | |
const removeDuplicates2 = array => Array.from(new Set(array)); | |
// Flattens an array(doesn't flatten deeply). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IteratorDemo { | |
// Iterator Method with @@iterator key | |
// i.e. Symbol.iterator constant | |
[Symbol.iterator]() { | |
// Method stub which returns an iterator object. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RangeIterator { | |
constructor({ | |
start = 0, | |
end = 1000, | |
step = 1 | |
}) { | |
this.start = start; | |
this.end = end; | |
this.step = step; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RangeGenerator { | |
constructor({ | |
start = 0, | |
end = 1000, | |
step = 1 | |
}) { | |
this.start = start; | |
this.end = end; | |
this.step = step; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node { | |
constructor(value) { | |
this.value = value; | |
this.next = null; | |
} | |
} | |
class LinkedList { | |
constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Iterator function. | |
* | |
* @returns | |
* @memberof LinkedList | |
*/ | |
[Symbol.iterator]() { | |
let current = this.head; | |
const iterable = { | |
next: () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generator function. | |
*[Symbol.iterator]() { | |
let current = this.head; | |
while (current !== null) { | |
const { value } = current; | |
current = current.next; | |
yield value; | |
} | |
} |
OlderNewer