Friday, May 9, 2025
Latest:
  • Der kleine Vogel und die Sonne
  • German alphabet pronunciation
  • Command design pattern
  • German words with gender
  • When to use einen and keinen in German?
Upokary

Upokary

Quality information

  • Health
  • Life
  • Fashion
  • Food
  • Code
  • English
  • বাংলা
Technology 

How to stop adding, modifying and deleting an object’s properties?

Published: August 7, 2021freeze, JavaScript, object

In JavaScript, we can use the freeze() method of Object to stop adding, modifying, and deleting an object’s properties. The freeze() method will only allow us to read properties. It will not allow adding, modify and delete operations to the object.

Following is the code sample:

const userObj = {
    name: 'Joe Smith',
    gender: 'Male',
    age: 40
}

Object.freeze(userObj);
userObj.age = 50;
console.log(userObj);

You May Also Like

TypeError: Cannot assign to read only property of object ‘#Object’ reactjs

April 15, 2019 beroza

What is the purpose of JavaScript:void(0)?

August 31, 2021 beroza

Lexicographically Smallest Equivalent String

June 11, 2023 beroza

Reactjs app should use a boilerplate or use create-react-app from Facebook?

January 2, 2019 beroza

What is useEffect hook in React? How to use useEffect hook?

February 9, 2021 beroza

JavaScript arrow function related interview questions

March 18, 2019 beroza

could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket

October 11, 2020 beroza

How to check the installed Ubuntu version?

May 7, 2020 beroza

if-else statements inside JSX does not work in ReactJS

September 5, 2019 beroza

Why Upokary?

Upokary.com is a useful application in everyday life. It provides very handy information regarding every aspect of life. Each and every tip of upokary.com is meant to make life better.

Upokary tools

  • Youtube thumbnail
  • Youtube video downloader

Useful Links

  • Handy code
  • Technology
  • People
  • Programming
  • Quote
  • Travel
  • WordPress
  • IELTS
  • Kids

Languages

  • EnglishEnglish
  • বাংলাবাংলা

Pages

  • Sitemap
  • Privacy policy
  • About us
  • Contact us

Support

For any kind of query or question please drop a message in the following email: upokary@gmail.com
Copyright © 2025 Upokary. All rights reserved.