Register and share your invite link to earn from video plays and referrals.

Azlen
@azlenelza
Metacog in the machine
Joined December 2012
577 Following    14.1K Followers
more ways to declare a name in javascript: - using x = resource - class x {} - - for (x of [1]) {} // assigns x = 1 outside loop scope - for (x in {1:null}) {} // same but with the key "1" - globalThis.x = 1 - window.x = 1 - self.x = 1 - top.x = 1 - this.x = 1 // at top level these all target window - Object.defineProperty(globalThis, "x", {value:1}) - [x] = [1] - ({x} = {x: 1}) - import { x } from "..." - function x() {} - function* x() {} - async function x() {} - async function* x() {} - eval("...") // using any of the above - new Function("...")() // same
Show more
ways to declare a name in JS: - var foo - const foo - let foo - <div id="foo">