Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
la congelación de objetos no congela el objeto cuando se asigna a un nuevo objeto

Tengo 2 preguntas aquí: -

  1. Por qué obj2 = 5; no esta tirando el error?

  2. Si deseo lanzar durante la asignación obj2 = 5; ¿Qué tengo que hacer? Teniendo en cuenta que obj2 es var o let.

 "use strict" function deepFreeze(object) { // Retrieve the property names defined on object const propNames = Object.getOwnPropertyNames(object); // Freeze properties before freezing self for (const name of propNames) { const value = object[name]; if (value && typeof value === "object") { deepFreeze(value); } } return Object.freeze(object); } let obj2 = { internal: { a: null } }; deepFreeze(obj2); // obj2.internal.a = 'anotherValue'; // fails silently in non-strict mode // obj2.internal.a; // null obj2 = 5; // I want to throw error in this case but it is not throwing error.
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!