Skip navigation

Pass by value and pass by reference is age old concept. It is working similar way in JavaScript too. If you like to see some code so that you can understand better. Keep reading.

Brief theory before jump into code. JavaScript primitive types (string, number, boolean, null and undefined) are passed by value. Whereas non-primitive types (objects, arrays, functions, etc.) are passed by reference.

// Primitive types: Immutable by default
let x = 5
let y = x
y = 10
console.log(x) // output 5
console.log(y) // output 10

// Non-primitive types: Mutable
let animal = {
    name: 'Rat'
let anotherAnimal = animal = 'Horse'
console.log(animal) // {name: "Horse"}
console.log(anotherAnimal) // {name: "Horse"}
console.log(animal === anotherAnimal) // true

This knowledge might be useful while learning react.js, redux architecture.


JavaScript keeps giving shock to me even after using, learning since so long years! I just came to know that hasOwnProperty method is not guarded by the JavaScript language. Users can override it. Below code demonstrates how to override, consequences and work around.

var foo = {
    // overriding foo's default hasOwnProperty method
    hasOwnProperty: function() {
        return false;
    bar: 'rajakvk'

foo.hasOwnProperty('bar'); // false always

// using hasOwnProperty of of object and setting this to foo
({}), 'bar'); // true

// or use hasOwnProperty from the 
// Object prototype for this purpose, 'bar'); // true

Article published in TechAspect’s digital cum print edition of internal company official magazine TechTunes October 2015 issue (Vol 1, 2015)

Rapid and ever-growing browser technologies are a boon to internet users. At the same time, these cutting edge innovations present the developer community with a new set of opportunities and challenges. The autonomous nature of the internet produces conflicting opinions in many areas, such as standards bodies, un-finalized specs, browser differences, and so on; growth of mobile device use further adds fuel to the fire.


The ‘party’ is no longer server side but rather now inside the browser, which is controlled by the user. In other words, the browser is the new OS. Frontend developers often find themselves in unexplored territory. The shelf life of frontend technology has shortened considerably in recent years, calling for
developers to realign our strategies.

Impact on Project Success

Our success rate increases if we identify frontend risks well in advance. It is very easy to miss a CSS incompatibility, which results in a broken home page layout. The contents and underlying DOM are so dynamic they may be overlooked.


To avoid costly mistakes, it is important to understand frontend volatility, and to perform due diligence, even though it is challenging. It is also essential to understand clients’ requirements, select the right
technologies, accurately estimate UI costs, and select the right resources.