Category: JavaScript

Puppeteer and ShadowDOM

If you are testing an app – be it React, Angular or Vue – and you are using an library…

Object Or Array Check in JavaScirpt

Test whether an object is an object or an array if(Object.prototype.toString.apply(arr) === ‘[object Array]’) alert(“Array”) Original Article

Change shell

Change shell command chsh

Finding the Factorial using Recursion

Finding the Factorial using Recursion in javascript. function factorial(x) { if(x

A Simple Logging Function for JavaScript

Prints all the arguments of the function. This function uses console.log if firebug is available – else, uses alert. function…

Chainable interface in JavaScript

Creating Chainable interfaces in javascript… (function() { function _init() { return this; } _init.prototype = { “myFunction”: function() { return…

Execute JavaScript files using Rhino

The command to execute a javascript file using rhino. java -jar /path/to/custom_rhino.jar JS_File.js Get Custom Rhino(From Dojo Library)

Install Rhino

Installing Rhino(Javascript interpreter created in java) on Fedora 7 sudo yum install rhino-manual rhino-demo rhino

Scope and Binding in JavaScript

Function x executions in the scope of object y. var Car = function() { = ‘car’; } var Truck…

Find Element’s Position using JavaScript

Find the position of an element using javascript function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) {…