Javatpoint Logo
Javatpoint Logo

JavaScript Set add() method

The JavaScript Set add() method is used to add an element to Set object with a specified value. Each element must have a unique value.

Syntax

The add() method is represented by the following syntax:

Parameter

value - It represents the value to be added.

Return

The Set object.

JavaScript Set add() method example

Here, we will understand add() method through various examples.

Example 1

Let's see an example to add value of elements to set object.

Test it Now

Output:

jQuery
AngularJS
Bootstrap

Example 2

In this example, we will add the elements to set object in chainable form.

Test it Now

Output:

jQuery
AngularJS
Bootstrap






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA