Skip to content

Instantly share code, notes, and snippets.

View rchougule's full-sized avatar
💻

Rohan Chougule rchougule

💻
View GitHub Profile
@rchougule
rchougule / copyByReference.js
Created April 11, 2020 11:14
Copying an Object in Node.js is by default via Reference
const sports = {
default: false
};
const copySports = sports;
copySports.default = true;
console.log(sports);
//OUTPUT
"use strict";
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
@rchougule
rchougule / asyncWaterfall.js
Created September 28, 2020 21:07
Async Waterfall in JavaScript
function selectMovie(input, callback) {
const output = `Movie Selected: ${input} ->`;
callback(null, output);
}
function bookTicket(input, callback) {
const output = `${input}, Ticket ID: 1234 ->`;
callback(null, output);
}