- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of Object.isFrozen() method in JavaScript?
Object.isFrozen()
Object.isFrozen() method is used to find whether an object is frozen or not.
An object is frozen if it followed the below criteria
It should not be extensible.
Its properties should be non-configurable.
It shouldn't accept any new properties.
Syntax
Object.isFrozen(obj);
Parameters - Object.isFrozen() accepts an object as a parameter and scrutinizes whether it is frozen or not and returns a boolean output.
Example
In the following example Object.isFrozen() scrutinizes whether the object 'obj' is frozen or not. Since the object is not frozen, false will be displayed as the output.
<html> <body> <script> var object = { prop1 : 5 } var res = Object.isFrozen(object); document.write(res); </script> </body> </html>
Output
false
Example
In the following example since the object 'object' is frozen by using Object.freeze(), true will be displayed as the output.
<html> <body> <script> var object = { prop1 : 5 } Object.freeze(object); var res = Object.isFrozen(object); document.write(res); </script> </body> </html>
Output
true
- Related Articles
- What is the use of proxy() object in JavaScript?
- What is the use of map object in javascript?
- What is the use of _.size() method in JavaScript?
- What is the use of weakSet.has() method in JavaScript?
- What is the use of Object.is() method in JavaScript?
- What is the use of Atomics.store() method in JavaScript?
- What is the use of forEach() method in JavaScript?
- What is the use of Array.Reduce() method in JavaScript?
- What is the use of Array.Some() method in JavaScript?
- What is the use of Array.Find() method in JavaScript?
- What is the use of Array.findIndex() method in JavaScript?
- What is the use of Math.abs() method in JavaScript?
- What is the use of Math.pow() method in JavaScript?
- What is the use of substr() method in JavaScript?
- what is the use of slice() method in JavaScript?

Advertisements