Tag Archives: PHP

Defining Variable JavaScript

There are three ways of defining a variable in JavaScript:

Var
This is used to declare a variable and the value can be changed at a later time within the JavaScript code.

Const
We can also use this to declare/define a variable but the value, as the name implies, is constant throughout the JavaScript program and cannot be modified at a later time.

Let
This mostly implies that the values can be changed at a later time within the JavaScript code.

JavaScript Advantages

These are the advantages of JavaScript:

Enhanced Interaction
JavaScript adds interaction to otherwise static web pages and makes them react to users’ inputs.

Quick Feedback
There is no need for a web page to reload when running JavaScript. For example, form input validation.

Rich User Interface
JavaScript helps in making the UI of web applications look and feel much better.

Frameworks
JavaScript has countless frameworks and libraries that are extensively used for developing web applications and games of all kinds.

WeakSet Javascript

In javascript, Set is a collection of unique and ordered elements.

Just like Set, WeakSet is also a collection of unique and ordered elements with some key differences:

Weakset contains only objects and no other type.

An object inside the weakset is referenced weakly. This means, if the object inside the weakset does not have a reference, it will be garbage collected.

Unlike Set, WeakSet only has three methods, add() , delete() and has() .