Skip to content

Instantly share code, notes, and snippets.

View jsmuster's full-sized avatar
🎯
Focusing

Arseniy Tomkevich jsmuster

🎯
Focusing
View GitHub Profile
const numbers = [1, 2, 3];
numbers.push(4);
numbers.shift();
// 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";
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;
var xxx = ['', '', '', '', 'W', 'o', 'W', '', '', '', ''];
var nx = [];
xxx.forEach((el, index)=>
{
if(el != '' || el != null) { nx.push(el); }
},
()=>
{
console.log("all done", nx.join(""));
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);
}
Array.prototype.mown = function ()
{
var arr = [];
this.forEach(function(element)
{
if(element != "")
{
arr.push(element);
}
String.prototype.mown = function ()
{
return this.replace(/^\s+|\s+$/gm,'');
}
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);
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();
});
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']
})