Home » JavaScript WeakMap has() Method

JavaScript WeakMap has() Method

by Online Tutorials Library

JavaScript WeakMap has() method

The JavaScript WeakMap has() method indicates whether the ?WeakMap object contains the specified key. It returns true if the specified key is present, otherwise false.

Syntax

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

Parameter

key – It represents the key to be searched.

Return

A Boolean value.

JavaScript WeakMap has() method example

Let’s see an example to determine whether the WeakMap object contains the specified key.

Test it Now

Output:

true   

You may also like