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
const numbers = [1, 2, 3]; | |
numbers.push(4); | |
numbers.shift(); |
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
// declare a const object | |
const cfg = { | |
uid: "buddha" | |
}; | |
// this fails | |
cfg = {}; | |
// however, the variables inside the object itself can be changed | |
cfg.uid = "siddhartha gautama"; |
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
const PI = 3.141592653589793; | |
PI = 3.14; // This will give an error | |
PI = PI + 10; // This will also give an error | |
// these declarations will fail as well, because we can't do that after using const | |
var PI = 0; | |
let PI = 0; | |
const PI = 0; |
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
var xxx = ['', '', '', '', 'W', 'o', 'W', '', '', '', '']; | |
var nx = []; | |
xxx.forEach((el, index)=> | |
{ | |
if(el != '' || el != null) { nx.push(el); } | |
}, | |
()=> | |
{ | |
console.log("all done", nx.join("")); |
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
Array.prototype.forEach = function (fn, cb) | |
{ | |
var el; | |
for(var i = 0, l = this.length; i < l; i++) | |
{ | |
el = this[i]; | |
fn.call(this, el, i); | |
} |
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
Array.prototype.mown = function () | |
{ | |
var arr = []; | |
this.forEach(function(element) | |
{ | |
if(element != "") | |
{ | |
arr.push(element); | |
} |
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
String.prototype.mown = function () | |
{ | |
return this.replace(/^\s+|\s+$/gm,''); | |
} |
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
let reporter = function (type, ...rest) | |
{ | |
// remote reporter logic goes here | |
}; | |
/* handle an uncaught exception & exit the process */ | |
process.on('uncaughtException', function (err) | |
{ | |
console.error((new Date).toUTCString() + ' uncaughtException:', err.message); | |
console.error(err.stack); |
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
app.use(function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | |
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
import { Component, OnInit } from '@angular/core'; | |
import {UserInfoModel} from '../models/userInfo'; | |
import { HttpClient } from "@angular/common/http"; | |
import { ActivatedRoute } from '@angular/router'; | |
@Component({ | |
selector: 'display-user-data', | |
templateUrl: './display-user-data.component.html', | |
styleUrls: ['./display-user-data.component.css'] | |
}) |
NewerOlder