A little bit in-depth of JavaScript

Muhammad Abdus Samad
3 min readNov 4, 2020

1. Types in JS:

The types are building blocks of programming language. JavaScript is a dynamic language that creates interactivity in the applications using its syntax, standard built-in Objects and Methods. JavaScript’s types are;

a. Number

b. String

c. Boolean

d. Object

i. Function

ii. Array

iii. Date

e. Symbol

f. Null

g. Undefined

2. Primitive value:

Primitive values are numbers and strings. In JavaScript, a is data that is not an object and has no methods. There are 6 primitive data types: string, number, bigInt, boolean, undefined, and symbol.

3. Try-catch:

Tri-catch is error handling technique in JavaScript. A try…catch is a commonly used statement in various programming languages. It is in fact used to handle the error-prone part of the code. It initially tests the code for all possible errors it may contain, then it implements actions to tackle those errors if so happen. A good programming practice is to keep the complex code within the try…catch statements.

4. Coding best practice:

JavaScript coding best practices are as follows:

· Introduction.

· Call things by their name — easy, short and readable variable and function names.

· Avoid globals.

· Stick to a strict coding style.

· Comment as much as needed but not more.

· Avoid mixing with other technologies.

· Use shortcut notation when it makes sense.

· Modularize — one function per task.

5. ES6:

ES6 stands for ECMAScript 6. ECMAScript was created to standardize JavaScript, and ES6 is the 6th version of ECMAScript, it was published in 2015, and is also known as ECMAScript 2015.

React uses ES6, and you should be familiar with some of the new features like:

Classes

Arrow Functions

Variables (let, const, var)

6. JavaScript Functions:

JS functions are structured to perform a task. Functions are executed only when something in somewhere invokes or calls it. So the parameters are to be returned by calling the function declared. The function starts with the ‘function’ keyword. However; arrow functions and class functions are mostly used functions in react js and in other frameworks nowadays.

7. Arrow Function:

Arrow functions also called “fat arrowfunctions, are a more concise syntax for writing function expressions. They utilize a new token ‘=>’ that looks like a fat arrow. Arrow functions make our code more concise and simplify function scoping and this keyword.

8. Comments in JS:

Comments are single-line: starting with // and multiline: /* ... */. We normally use them to describe how and why the JavaScript code works. Firstly, commenting might be obvious, but new in programming often uses them inappropriately. Good comment has the following features:

· Overall architecture, high-level view.

· Function usage.

· Important solutions, especially when not immediately obvious.

9. Balancing client-side and server-side:

Servers will always want more control and less cost, while clients clearly want faster communication and more security. Ultimately, the correct caching relationship comes down to the age-old non-answer of “what works best for your situation.” This basic communication underlies every protocol, architecture, and approach. In the online space, many techniques are collectively referred to as “caching” due to their ability to mirror this functionality. In the simplest terms, caching is a general computer concept that provides efficiency through data availability. The mechanism by which this is accomplished is through the storage of commonly accessed data in several places, and then serving that data to requesters from the common data store. This is opposed to generating new content each time it is requested.

10. Default perimeter:

In JavaScript, default function parameters allow you to initialize named parameters with default values if no values or undefined are passed into the function. We typically use the term argument and parameter interchangeably. However, by definition, parameters are what we specify in the function declaration whereas the arguments are what we pass into the function.

--

--