-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Manish Jain
committed
Nov 25, 2016
1 parent
e7e6415
commit 50d4c24
Showing
122 changed files
with
12,910 additions
and
167 deletions.
There are no files selected for viewing
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
134 changes: 134 additions & 0 deletions
134
ECMAScript6-practice-001/Class-declaration/Class-declaration-001.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
class Polygon { | ||
constructor (height,width){ | ||
this.height = height; | ||
this.width = width; | ||
} | ||
get area(){ | ||
return this.calcArea(); | ||
} | ||
calcArea(){ | ||
return this.height * this.width | ||
} | ||
} | ||
|
||
const square = new Polygon(10, 10); | ||
|
||
console.logger('square.area ',square.area); | ||
|
||
class Point { | ||
constructor (x,y){ | ||
this.x = x; | ||
this.y = y; | ||
} | ||
static distance(a,b){ | ||
const dx = a.x - b.x; | ||
const dy = a.y - b.y; | ||
|
||
return Math.sqrt(dx*dx + dy*dy) | ||
} | ||
} | ||
|
||
const p1 = new Point(5, 5); | ||
const p2 = new Point(10, 10); | ||
|
||
console.logger('Point.distance(p1, p2) ',Point.distance(p1, p2)); | ||
|
||
class Animal{ | ||
constructor(name){ | ||
this.name = name | ||
} | ||
speak(){ | ||
console.logger(this.name + ' makes a noise.'); | ||
} | ||
} | ||
|
||
class Dog extends Animal{ | ||
speak(){ | ||
console.logger(this.name + ' barks.'); | ||
} | ||
} | ||
|
||
var d = new Dog('Mitzie'); | ||
d.speak(); | ||
|
||
function AnimalP (name) { | ||
this.name = name; | ||
} | ||
|
||
AnimalP.prototype.speak = function () { | ||
console.logger(this.name + ' makes a noise.'); | ||
} | ||
|
||
class DogP extends AnimalP { | ||
speak() { | ||
console.logger(this.name + ' barks.'); | ||
} | ||
} | ||
|
||
var d = new DogP('Mitzie'); | ||
d.speak(); | ||
|
||
|
||
var AnimalQ = { | ||
speak() { | ||
console.logger(this.name + ' makes a noise.'); | ||
} | ||
}; | ||
|
||
class DogQ { | ||
constructor(name) { | ||
this.name = name; | ||
} | ||
speak() { | ||
console.logger(this.name + ' barks.'); | ||
} | ||
} | ||
|
||
Object.setPrototypeOf(DogQ.prototype, AnimalQ); | ||
|
||
var d = new DogQ('Mitzie'); | ||
d.speak(); | ||
|
||
class Cat { | ||
constructor(name){ | ||
this.name = name; | ||
} | ||
speak(){ | ||
console.logger(this.name + ' makes a noise.'); | ||
} | ||
} | ||
|
||
class Lion extends Cat{ | ||
speak(){ | ||
super.speak(); | ||
console.logger(this.name + ' roars.'); | ||
} | ||
} | ||
var l = new Lion('Lion'); | ||
l.speak(); | ||
|
||
class PointC { | ||
constructor(x,y){ | ||
this.x = x; | ||
this.y =y; | ||
} | ||
toString(){ | ||
return '(' + this.x + ', ' + this.y + ')'; | ||
} | ||
} | ||
|
||
class ColorPoint extends PointC { | ||
constructor(x,y,color){ | ||
super(x,y); | ||
this.color = color; | ||
} | ||
toString(){ | ||
return super.toString() + ' in ' + this.color; | ||
} | ||
} | ||
|
||
let cp = new ColorPoint(25, 8, 'green'); | ||
console.logger('cp.toString() ',cp.toString()); // '(25, 8) in green' | ||
|
||
console.logger(cp instanceof ColorPoint); // true | ||
console.logger(cp instanceof PointC); // true |
116 changes: 116 additions & 0 deletions
116
ECMAScript6-practice-001/Object-literals/Object-literals-001.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
var a; | ||
console.logger("The value of a is " + a); // The value of a is undefined | ||
|
||
console.logger("The value of b is " + b); // The value of b is undefined | ||
var b; | ||
try{ | ||
console.logger("The value of c is " + c); // Uncaught ReferenceError: c is not defined | ||
}catch(error){ | ||
console.logger('Error ',error.message); | ||
} | ||
|
||
|
||
let x; | ||
console.logger("The value of x is " + x); // The value of x is undefined | ||
|
||
try{ | ||
console.logger("The value of y is " + y); // Uncaught ReferenceError: y is not defined | ||
let y; | ||
}catch(error){ | ||
console.logger('Error ',error.message); | ||
} | ||
|
||
|
||
if (true) { | ||
var x1 = 5; | ||
} | ||
console.logger('x1 is ',x1); // x is 5 | ||
|
||
if (true) { | ||
let y1 = 5; | ||
} | ||
|
||
try{ | ||
console.logger('y1 is ',y1); | ||
}catch(error){ | ||
console.logger('Error ',error.message); | ||
} | ||
|
||
console.logger('########## Variable hoisting #########'); | ||
|
||
/** | ||
* Example 1 | ||
*/ | ||
console.logger(x2 === undefined); // true | ||
var x2 = 3; | ||
|
||
/** | ||
* Example 2 | ||
*/ | ||
// will return a value of undefined | ||
var myvar = "my value"; | ||
|
||
(function() { | ||
console.logger(myvar); // undefined | ||
var myvar = "local value"; | ||
})(); | ||
|
||
|
||
/** | ||
* Example 1 | ||
*/ | ||
var x3; | ||
console.logger(x3 === undefined); // true | ||
x3 = 3; | ||
|
||
/** | ||
* Example 2 | ||
*/ | ||
var myvar = "my value"; | ||
|
||
(function() { | ||
var myvar; | ||
console.logger(myvar); // undefined | ||
myvar = "local value"; | ||
})(); | ||
|
||
|
||
|
||
console.logger('########## Function hoisting #########'); | ||
|
||
|
||
/* Function declaration */ | ||
|
||
foo(); // "bar" | ||
|
||
function foo() { | ||
console.logger("bar"); | ||
} | ||
|
||
|
||
/* Function expression */ | ||
try{ | ||
baz(); // TypeError: baz is not a function | ||
}catch(error){ | ||
console.logger('Error ',error.message); | ||
} | ||
|
||
|
||
var baz = function() { | ||
console.logger("bar2"); | ||
}; | ||
|
||
|
||
var myObject = { | ||
['myString']: 'value 1', | ||
get myNumber() { | ||
return this._myNumber; | ||
}, | ||
set myNumber(value) { | ||
this._myNumber = Number(value); | ||
} | ||
}; | ||
|
||
console.logger(myObject.myString); // => 'value 1' | ||
myObject.myNumber = '15'; | ||
console.logger(myObject.myNumber); // => 15 |
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
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
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
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
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
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
17 changes: 0 additions & 17 deletions
17
...S-javascript-practice-target/Portal-Module/Component-Portal/app/view/header/HeaderView.js
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
ExtJS-javascript-practice-target/Portal-Module/Component-Portal/index.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="utf-8"/> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<title>Ext JS 5.1.1 Practice Target</title> | ||
<link rel="stylesheet" type="text/css" href="/extjs 5.1.1/css/theme/ext-theme-classic-all-debug.css"/> | ||
<link rel="stylesheet" type="text/css" href="/css/style.css"/> | ||
</head> | ||
<body> | ||
<script type="text/javascript" src = '/extjs 5.1.1/ext-all-debug.js'></script> | ||
<script type="text/javascript"> | ||
Ext.Loader.setConfig({ | ||
enabled: true | ||
}); | ||
Ext.Loader.setPath('Ext.ux', '../../extjs 5.1.1/ux'); | ||
Ext.Loader.setPath('Common', '../common'); | ||
</script> | ||
<script type="text/javascript" src = 'app.js'></script> | ||
</body> | ||
</html> |
Oops, something went wrong.