Aspirant Wavestone Logo

January 2, 2019

JavaScript Concepts Every Manager Should Know

App Development & Integration

Managers who don’t know the ins and outs of JavaScript but oversee a workforce that does should become familiar with certain phrases and terms related to it. This will not only aid in communication with employees, but will also assist in helping your customers or clients with questions. JavaScript concepts may seem overwhelming, but with a little research you should be able to at least follow a conversation and understand what’s going on.

Closures

This is a simple and seemingly obvious JavaScript term. A closure refers to a function retaining its access to the scope in which it was created. Closures allow for memorization, data hiding and dynamic function generation. It’s an inner function with access to the outer enclosing functions variables. It has access to its own scope, outer function’s variables and the global variables.

 

Scope

It’s important to understand the differences between local scope, global scope and block scope. Variables are considered local scope if they are inside a function. Those outside the function are global. Variables in local scope can have a different scope for each call of that function. Variables of the same name can be used for multiple functions.

A global scope can be altered and accessed in any other scope, as there is only one global scope in a JavaScript document. Block statements do not create new scopes, any variable defined inside a block statement will remain in their original scope.

 

Value vs. Reference

Objects, arrays, and functions are copied and passed into functions. The reference is what’s being copied. Primitives are copied and passed by copying the value. There are five data types in JavaScript which are copied by value, that’s Boolean, null, String, undefined, and Number. These are considered primitive types.

There are three types of data which are copied by having their reference copied, that’s Array, Object, and Function. These are technically Objects.

 

Higher Order Functions

Functions are first-class objects in JavaScript. Higher Order functions are functions that can take another function as an argument, or that returns a function as a result. This is one of the things about JavaScript which make it so suitable for functional programming.

Objects can be assigned as the value of a variable, and can be passed and returned such as any other reference variable. This is basically a JavaScript superpower and leads to a very natural approach to functional programming.

 

Prototypes and Inheritance

Inheritance in JavaScript works through the Prototype chain. It can be set up through functions and objects. The JavaScript term inheritance refers to an object’s ability to access methods and properties from another object.

 

Hoisting

Variable and function declarations are what’s called hoisted (lifted and declared) to the top of their available scope, if defined in a function, at the top of the global context or outside a function.

Function expressions are not hoisted, only variable declarations, so not variable initialization or assignments. As it takes precedence, function declaration will override a variable declaration when hoisted.

 

‘Apply,’ ‘Call,’ ‘Bind’

These methods are different only slightly, and it can be hard to remember which function does what. ‘Call’ invokes the function while allowing you to pass in arguments one at a time. ‘Apply’ also invokes the function but allows you to pass in arguments as an array. And finally, ‘bind’ returns a new function, allowing you to pass in a ‘this’ array and any number of arguments.

Now, after that you are not going to be a  JavaScript expert, but you should have an easier time trying to follow along in a conversation with people who are. There’s way more to JavaScript than you can imagine, to learn more, connect with us here at Aspirant!

New call-to-action

 

Ed is an accomplished technology leader with over 20 years of experience across a wide variety of roles. His career is marked by his expertise in software development, product management, and systems integration, with a proven track record of leading cross-functional teams to deliver enterprise-grade solutions. He is an analytical problem solver with proven success introducing new processes, procedures, and standards to manage technical debt and enhance product quality.​

Related posts