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
//JS Fiddle Link:- https://jsfiddle.net/mukherjeeronit/3ob2gyz9/7 | |
function StudentManagementSystem() { | |
var students = []; //Private Variable | |
function _getStudentById(id) { //Private Method | |
for (var i = 0; i < students.length; i++) { | |
var student = students[i]; | |
if (student.id == id) { | |
return 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
var currentStudentCount = 10; | |
function getNewlyAddedStudentCount(callbackFn){ // Anonymous function captured in "callbackFn" variable | |
setTimeout(function(){ | |
callbackFn(5); // "callbackFn" variable used to call the anonymous function received as parameter | |
},1000); | |
} | |
function printStudentCount(){ | |
getNewlyAddedStudentCount(function(newlyAddedCount){ //Anonymous function passed as parameter to another function | |
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
//Solution to problem mentioned in https://codepen.io/ronit-mukherjee/pen/rQrpJZ | |
//A Local variable having last updated count of friends for the loggedin user | |
let frndsCount = 65; | |
//A function to fetch the latest count of friends from the server for the loggedin user | |
const fetchFrndsCountFromServer = (callbackFn) => { | |
setTimeout(()=>{ //Emulating an Asynchronous API call which takes 1000 i.e 1 Sec to fetch data from server |
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
//A Local variable having last updated count of friends for the loggedin user | |
let frndsCount = 65; | |
//A function to fetch the latest count of friends from the server for the loggedin user | |
const fetchFrndsCountFromServer = () => { | |
setTimeout(()=>{ //Emulating an Asynchronous API call which takes 1000 i.e 1 Sec to fetch data from server | |
return 87; | |
},1000); | |
} |
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 gulp = require('gulp'); | |
const sourcemaps = require('gulp-sourcemaps'); | |
const babel = require('gulp-babel'); | |
const concat = require('gulp-concat'); | |
const sass = require('gulp-sass'); | |
const autoprefixer = require('autoprefixer'); | |
const browserSync = require('browser-sync').create(); | |
const htmlmin = require('gulp-htmlmin'); | |
const inject = require('gulp-inject'); | |
const minifyJS = require("gulp-uglify"); |
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
//https://www.hackerrank.com/challenges/birthday-cake-candles/problem | |
'use strict'; | |
const fs = require('fs'); | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf-8'); | |
let inputString = ''; | |
let currentLine = 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
//https://www.hackerrank.com/challenges/mini-max-sum/problem | |
'use strict'; | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf-8'); | |
let inputString = ''; | |
let currentLine = 0; | |
process.stdin.on('data', inputStdin => { |
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
//https://www.hackerrank.com/challenges/staircase/problem | |
'use strict'; | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf-8'); | |
let inputString = ''; | |
let currentLine = 0; | |
process.stdin.on('data', inputStdin => { |
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
'use strict'; | |
const fs = require('fs'); | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf-8'); | |
let inputString = ''; | |
let currentLine = 0; |