
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements