Skip to content

Instantly share code, notes, and snippets.

View jitendra19's full-sized avatar
🎯
Focusing

Jitendra Singhal jitendra19

🎯
Focusing
View GitHub Profile
@jitendra19
jitendra19 / lexical-scoping-txt
Last active January 29, 2019 13:20
JS questions
function foo() {
console.log(abc)
}
function goo() {
var abc = 1;
foo();
}
goo();
// ReferenceError: abc is not defined
var a = {
m: function() {
console.log(this); // {m:f}
(function(){
console.log(this); // window object
})();
}
}
a.m();
// {m:f}
// construction pattern
function abc(a,b){
this.a=a;
this.b=b;
}
var obj = new abc('123','456')
// construction pattern
function abc(a,b){
this.a=a;
this.b=b;
}
var obj = new abc('123','456')
"use strict";
var animal = {
kind: "Cow",
which: function () {
console.log(this.kind);
}
};
var animalFunc = animal.which;
animalFunc();
function a(){
console.log(this.abc);
}
Function.prototype.bindMe = function(scope){
return function(args){
this.apply(scope, args);
}.bind(this)
}
// What would be the output of following code?
var arrA = [{prop1: "value of array A!!"}, {someProp: "also value of array A!"}];
var arrB = arrA.slice();
arrB[0].prop1=42;
console.log(arrA);
// What would be the output of following code
var employeeId = 'abc123';
function foo() {
employeeId = '123bcd';
return;
function employeeId() {}
}
@jitendra19
jitendra19 / index.html
Created April 23, 2020 18:32
vue JS practice
<div id="app">
<h1 class="bg-light fixed-top">{{name}}</h1>
<nav class="navbar navbar-light ">
<div class="navbar-text ml-auto">
<b>cart:</b>
<span class="badge badge-pill badge-success"></span>
</div>
</nav>
@jitendra19
jitendra19 / index.html
Created April 25, 2020 17:38
Vue/Bootstrap Template
<div id="app">
<nav class="navbar navbar-light fixed-top">
<div class="navbar-text ml-auto d-flex">
<button class="btn btn-sm btn-outline-success"
@click="sliderStatus = !sliderStatus">
<i class="fas fa-dollar-sign"></i></button>
<div class="ml-2">
<button class="btn btn-success btn-sm dropdown-toggle"
id="cartDropdown" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">