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

189
Views
¿Una variable en JS no se elimina pero aquí no hay ningún error?

tengo una variable var variable; Es variable="Hello World"; . Ahora, sin usar var y borrarlo:

 document.write(myVar); delete myVar; console.log("This should be an error because myVar has been deleted: "); console.log(myVar);
 <!--This is my module--> <script> myVar = "Hello"; </script>

Pero con 'use strict'; , no hay ningún error con la eliminación, y no hay ningún error a pesar de que no puede eliminar una var?

 console.log("My Code Is Running"); delete myVar; if (!myVar){ document.write("Var Has Been Deleted"); } console.log("My Code Is Done"); // Why does it not write "Var Has Been Deleted"? // There is no 'use strict' to stop the delete.
 <script> 'use strict'; var myVar = "Hello World"; </script>
¿Lo que está sucediendo?

Gracias por adelantado

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!