B
ByteNote

导航

首页文章工具关于

© 2025 ByteNote

B
ByteNote

JS Object.freeze() 冻结对象

Aug 31, 20229 min read

不能向这个对象添加新的属性,不能删除已有属性,不能修改该对象已有属性的可枚举性、可配置性、可写性,以及不能修改已有属性的值,相当于Object.seal + 所有属性writable:false

const obj = {
    name: 'wahaha'
  }

  Object.seal(obj)

  obj.age = 18
  obj.age // undefined
  obj.name = 'cinob'
  console.log(obj.name) // wahaha
  delete obj.name // false
  console.log(obj.name) // wahaha

相关文章

Git Merge Mastery: Unveiling the Differences Between Merge, Rebase, and Fast-Forward

Git merging strategies include merge (preserving history), rebase (clean history), and fast-forward (strict, linear merges), each suited for different team collaboration needs.

Solving Local Network Access Issues with DDNS A Comprehensive Guide

This guide provides multiple solutions, including enabling NAT Loopback, using a hosts file, setting up a local DNS server with Dnsmasq, or implementing split-horizon DNS, to resolve the issue of accessing local network services via a Dynamic DNS domain name from within the same network.

Complete Guide to WireGuard VPN Setup Server and All Clients

This comprehensive guide provides step-by-step instructions for setting up a WireGuard VPN server using Docker, configuring clients on Linux, MacOS, mobile devices, and Windows, and managing the server and clients for optimal security and performance.