Basic JavaScript

Ashik Bhuyan
3 min readMay 6, 2021

Primitive Values

In JavaScript, primitive values and primitive data type is not an object or has no method. All primitive values are immutable. Primitive we cannot change because a primitive itself variable assigned a primitive value. We can reassign any value, but the existing value is never changing. But object and array can be changed.
var bar = “baz”;
console.log(bar);
bar.toUpperCase();
console.log(bar);
Answer: baz,
baz,
undefined
There are seven primitive data-type as there are
string
number
boolean
undefined
symbol
null

Objects and Functions

Object and function are also value but they are not primitive.if i give any example i think it will be cleared
console.log({});
console.log([]);
console.log(x => x * 2);
answer: {}
[]
x => x * 2

Objects and Expression

you cannot share all your true feelings with your favorite person. In that way, javascript has some activities that which is acceptable. Such for example that
console.log(2+6)
the answer is: 8
in the proposal, if it acceptable javascript gives the right answer. lastly, I can say that expression is like a question that javascript can give this answer. The main summary is Expression means string, number, an object that JavaScript can able to give this answer.
Types of Values
if people want that they can research JavaScript. Brandan Eich made JavaScript. but after 25 years they able to succeed to make nine things. In which any type of website or any application can build by those nine such types.

Object Method

A method in object-oriented programming is a procedure associated with a message and an object This allows the sending objects to invoke behaviors and to delegate the implementation of those behaviors to the receiving object. A method in JavaScript programming sets the behavior of a class object.

Function

Functions are the most fundamental building block of every programming language. A function in JavaScript is similar to the other programming language. A function is a procedure or a set of statements that performs a task or calculates a value. Because function takes arguments and performs some task and return a value.

Semicolons

To use them, or not to use them…

Nowadays freshers are getting confused about whether they will use semicolons or not!! Because some people decided to avoid semicolons in javascript. But a semicolon should be present after each statement, even if it could possibly be skipped. In JavaScript, though, there are cases where a line break is not interpreted as a semicolon, leaving the code vulnerable to errors.

Good Comments

Commenting is always a good practice for developers. An important sign for a developer is commenting. Every good developer uses some tricks to do comments. They know that good comments maintain a developer to make code readable. Every junior developer should follow these rules. They should provide a high overview of code, give an explanation of how and why it works.

Self-documenting

Code should be self-documenting. This is also one way to making your code easier to understand. I think self-documenting code comes with practice and a level of expertise is also required. What should be the maximum length of a variable/function name also becomes a necessity is self-documenting.

Self-documenting code is written using human-readable names, consisting of a phrase in a human language which reflects the symbol’s meaning, such as article.

The code must also have a clear and clean structure so that a human reader can easily understand the algorithm used. It totally depends on a developer (and/or maybe team/company).

--

--