JavaScript ਨੂੰ ਕਦੇ ਵੀ ਉਹ ਬਣਨ ਲਈ ਨਹੀਂ ਬਣਾਇਆ ਗਿਆ ਸੀ ਜੋ ਇਹ ਅੱਜ ਹੈ। 1995 ਵਿੱਚ, Brendan Eich ਨੇ Netscape ਵਿੱਚ ਬੈਠ ਕੇ ਦਸ ਦਿਨਾਂ ਵਿੱਚ ਇੱਕ ਪ੍ਰੋਟੋਟਾਈਪ ਤਿਆਰ ਕੀਤਾ। ਦਸ ਦਿਨ। ਇਹ ਇੱਕ ਵਧੀਆ ਸਪੈਸੀਫਿਕੇਸ਼ਨ ਲਿਖਣ ਲਈ ਵੀ ਬਹੁਤ ਘੱਟ ਸਮਾਂ ਹੈ, ਅਰਬਾਂ ਡਿਵਾਈਸਾਂ ਨੂੰ ਚਲਾਉਣ ਲਈ ਬਣਾਈ ਗਈ ਪ੍ਰੋਗਰਾਮਿੰਗ ਭਾਸ਼ਾ ਨੂੰ ਡਿਜ਼ਾਈਨ ਕਰਨਾ ਤਾਂ ਦੂਰ ਦੀ ਗੱਲ ਹੈ। ਨਤੀਜੇ ਵਜੋਂ ਇੱਕ ਅਜਿਹੀ ਭਾਸ਼ਾ ਮਿਲੀ ਜਿਸ ਵਿੱਚ ਅਜਿਹੇ ਅਜੀਬ ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ (quirks) ਹਨ ਜਿਨ੍ਹਾਂ 'ਤੇ ਡਿਵੈਲਪਰ ਅੱਜ ਵੀ ਤਕਰੀਬਨ ਤਿੰਨ ਦਹਾਕੇ ਬਾਅਦ ਫਸ ਜਾਂਦੇ ਹਨ। ਫਿਰ ਵੀ ਉਹੀ ਕਾਹਲੀ ਵਿੱਚ ਬਣਾਈ ਗਈ ਰਚਨਾ ਸਾਫਟਵੇਅਰ ਦੇ ਇਤਿਹਾਸ ਵਿੱਚ ਸਭ ਤੋਂ ਵੱਧ ਵਰਤੀ ਜਾਣ ਵਾਲੀ runtime ਬਣ ਗਈ। ਇਹ ਇਸ ਲਈ ਨਹੀਂ ਜਿੱਤੀ ਕਿਉਂਕਿ ਇਹ ਸ਼ਾਨਦਾਰ ਸੀ, ਸਗੋਂ ਇਸ ਲਈ ਜਿੱਤੀ ਕਿਉਂਕਿ ਇਹ ਬਿਲਕੁਲ ਉਸ ਸਮੇਂ ਬ੍ਰਾਊਜ਼ਰ ਦੇ ਅੰਦਰ ਸ਼ਿਪ ਹੋਈ ਜਦੋਂ ਵੈੱਬ ਨੂੰ ਇਸਦੀ ਲੋੜ ਸੀ।
ਕਾਹਲੀ ਵਿੱਚ ਜਨਮ
ਨੱਬੇ ਦੇ ਦਹਾਕੇ ਦੇ ਅੱਧ ਵਿੱਚ ਬ੍ਰਾਊਜ਼ਰ ਦੀਆਂ ਜੰਗਾਂ ਕੋਈ ਦੋਸਤਾਨਾ ਮੁਕਾਬਲਾ ਨਹੀਂ ਸਨ। Netscape ਨੂੰ ਇੱਕ ਹਲਕੀ-ਫੁਲਕੀ scripting language ਦੀ ਲੋੜ ਸੀ ਜੋ ਉਸਦੇ Navigator ਬ੍ਰਾਊਜ਼ਰ ਵਿੱਚ Java ਦੇ ਨਾਲ ਚੱਲ ਸਕੇ। Eich ਨੂੰ ਕੁਝ ਅਜਿਹਾ ਬਣਾਉਣ ਦਾ ਕੰਮ ਸੌਂਪਿਆ ਗਿਆ ਸੀ ਜੋ ਅਧਿਕਾਰੀਆਂ ਨੂੰ ਖੁਸ਼ ਕਰਨ ਲਈ Java ਵਰਗਾ ਦਿਖਾਈ ਦੇਵੇ, ਪਰ ਗੈਰ-ਪ੍ਰੋਗਰਾਮਰਾਂ ਲਈ ਵੈੱਬ ਪੇਜਾਂ ਵਿੱਚ ਪੇਸਟ ਕਰਨ ਲਈ ਕਾਫ਼ੀ ਸਧਾਰਨ ਹੋਵੇ। ਸਮੇਂ ਦੀ ਸੀਮਾ ਬੇਤੁਕੀ ਸੀ। ਉਸਨੇ Mocha ਤਿਆਰ ਕੀਤਾ, ਜਿਸਦਾ ਨਾਮ ਜਲਦੀ ਹੀ LiveScript ਰੱਖ ਦਿੱਤਾ ਗਿਆ, ਅਤੇ ਅੰਤ ਵਿੱਚ Java ਦੀ ਪ੍ਰਸਿੱਧੀ ਦਾ ਲਾਭ ਉਠਾਉਣ ਲਈ ਮਾਰਕੀਟਿੰਗ ਤੌਰ 'ਤੇ JavaScript ਰੱਖਿਆ ਗਿਆ।
ਉਸ ਕਾਹਲੀ ਵਿੱਚ ਜਨਮ ਨੇ ਸਥਾਈ ਨਿਸ਼ਾਨ ਛੱਡ ਦਿੱਤੇ। Type coercion ਅਜੇ ਵੀ ਨਵੇਂ ਆਉਣ ਵਾਲਿਆਂ ਨੂੰ ਉਲਝਾਉਂਦਾ ਹੈ ਜਦੋਂ plus operator ਬਿਨਾਂ ਕਿਸੇ ਚੇਤਾਵਨੀ ਦੇ strings ਅਤੇ numbers ਨੂੰ ਜੋੜ ਦਿੰਦਾ ਹੈ। typeof null ਇੱਕ ਬੱਗ ਕਾਰਨ "object" ਵਾਪਸ ਕਰਦਾ ਹੈ ਜੋ ਕਿ ਅਸਲ ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ ਵਿੱਚ ਸੀ ਅਤੇ ਕੋਈ ਵੀ ਵੈੱਬ ਨੂੰ ਖਰਾਬ ਹੋਣ ਦੇ ਡਰ ਤੋਂ ਇਸਨੂੰ ਠੀਕ ਕਰਨ ਦੀ ਹਿੰਮਤ ਨਹੀਂ ਕਰਦਾ। Automatic semicolon insertion ਚੁੱਪਚਾਪ ਫੇਲ੍ਹ ਹੋਣ ਦਾ ਕਾਰਨ ਬਣਦਾ ਹੈ। var ਨਾਲ ਐਲਾਨੇ ਗਏ ਵੇਰੀਏਬਲ ਅਜਿਹੇ ਤਰੀਕਿਆਂ ਨਾਲ scope ਲੀਕ ਕਰਦੇ ਹਨ ਜੋ ਅਨੁਮਾਨਿਤ ਨਹੀਂ ਲੱਗਦੇ। ਇਹ ਕੋਈ ਅਮੂਰਤ ਡਿਜ਼ਾਈਨ 결함 (flaws) ਨਹੀਂ ਹਨ। ਇਹ ਰੋਜ਼ਾਨਾ ਦੀਆਂ ਨਿਰਾਸ਼ਾਵਾਂ ਹਨ ਜੋ ਸਿੱਧੇ ਤੌਰ 'ਤੇ ਮਈ 1995 ਦੇ ਦੋ ਹਫ਼ਤਿਆਂ ਦੇ ਸਪ੍ਰਿੰਟ ਨਾਲ ਜੁੜੀਆਂ ਹੋਈਆਂ ਹਨ।
ਇੱਕ ਅਜੀਬ ਵੰਸ਼ਾਵਲੀ
JavaScript ਨੂੰ ਧਿਆਨ ਨਾਲ ਦੇਖੋਗੇ ਤਾਂ ਤੁਹਾਨੂੰ ਤਿੰਨ ਵੱਖ-ਵੱਖ ਵੰਸ਼ਾਵਲੀਆਂ ਜੁੜੀਆਂ ਹੋਈਆਂ ਦਿਖਾਈ ਦੇਣਗੀਆਂ। ਇਸਦਾ syntax Java ਤੋਂ ਬਹੁਤ ਜ਼ਿਆਦਾ ਉਧਾਰ ਲੈਂਦਾ ਹੈ। Curly braces, if statements, ਅਤੇ for loops C-style ਭਾਸ਼ਾਵਾਂ ਤੋਂ ਆਉਣ ਵਾਲੇ ਕਿਸੇ ਵੀ ਵਿਅਕਤੀ ਲਈ ਇੱਕ ਜਾਣ ਪਛਾਣ ਵਾਲਾ ਰੂਪ ਪ੍ਰਦਾਨ ਕਰਦੇ ਹਨ। ਪਰ ਉਸ ਸਤਹ ਦੇ ਹੇਠਾਂ, ਵਿਵਹਾਰ ਪੂਰੀ ਤਰ੍ਹਾਂ ਵੱਖਰਾ ਹੈ।
ਭਾਸ਼ਾ ਦਾ ਅਸਲ ਕੰਪਿਊਟੇਸ਼ਨਲ ਦਿਲ Scheme ਤੋਂ ਆਉਂਦਾ ਹੈ, ਜੋ ਕਿ Lisp ਦਾ ਇੱਕ ਉਪ-ਭਾਸ਼ਾ (dialect) ਹੈ। ਇੱਥੇ ਹੀ JavaScript ਨੂੰ first-class functions ਮਿਲੇ, ਜਿਸਦਾ ਮਤਲਬ ਹੈ ਕਿ functions ਨੂੰ arguments ਵਜੋਂ pass ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ, ਦੂਜੇ functions ਤੋਂ return ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ, ਅਤੇ variables ਨੂੰ assign ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ। ਇਸਨੇ ਸਾਨੂੰ closures ਵੀ ਦਿੱਤੇ, ਜੋ ਇੱਕ ਅੰਦਰਲੇ function ਨੂੰ ਬਾਹਰੀ function ਦੇ ਖਤਮ ਹੋਣ ਤੋਂ ਬਾਅਦ ਵੀ ਉਸਦੇ scope ਤੱਕ ਪਹੁੰਚ ਕਰਨ ਦੀ ਇਜਾਜ਼ਤ ਦਿੰਦੇ ਹਨ। ਜੇਕਰ ਤੁਸੀਂ ਕਦੇ ਵੀ callback ਲਿਖਿਆ ਹੈ ਜਾਂ event listener ਲਗਾਇਆ ਹੈ, ਤਾਂ ਤੁਸੀਂ Scheme ਤੋਂ ਵਿਰਾਸਤ ਵਿੱਚ ਮਿਲੇ DNA ਦੀ ਵਰਤੋਂ ਕੀਤੀ ਹੈ।
ਫਿਰ object model ਹੈ, ਜੋ Self ਤੋਂ ਆਉਂਦਾ ਹੈ। ਸਖ਼ਤ classes ਵਾਲੀ ਕਲਾਸੀਕਲ inheritance ਦੀ ਬਜਾਏ, JavaScript prototypes ਦੀ ਵਰਤੋਂ ਕਰਦਾ ਹੈ। ਇੱਕ object ਸਿੱਧੇ ਤੌਰ 'ਤੇ ਦੂਜੇ object ਨਾਲ ਜੁੜ ਸਕਦਾ ਹੈ ਅਤੇ property lookups ਨੂੰ ਉੱਪਰ ਵੱਲ ਡੈਲੀਗੇਟ ਕਰ ਸਕਦਾ ਹੈ। ਤੁਸੀਂ Object.create ਨਾਲ ਇੱਕ object ਬਣਾ ਸਕਦੇ ਹੋ ਅਤੇ ਬਿਨਾਂ ਕਿਸੇ class ਨੂੰ ਪਰਿਭਾਸ਼ਿਤ ਕੀਤੇ ਚੇਨਾਂ ਬਣਾ ਸਕਦੇ ਹੋ। ਆਧੁਨਿਕ JavaScript ਨੇ class keyword ਜੋੜਿਆ ਹੈ, ਪਰ ਇਹ ਜ਼ਿਆਦਾਤਰ ਇਸ ਅੰਡਰਲਾਈਂਗ prototype ਮਸ਼ੀਨਰੀ 'ਤੇ ਇੱਕ syntactic sugar ਹੈ।
ਪੇਜ ਦੀ ਸਜਾਵਟ ਤੋਂ ਲੈ ਕੇ ਇੱਕ ਗੰਭੀਰ ਟੂਲ ਤੱਕ
ਆਪਣੇ ਪਹਿਲੇ ਕੁਝ ਸਾਲਾਂ ਲਈ, JavaScript ਛੋਟੇ ਕੰਮ ਕਰਦਾ ਸੀ। ਇਹ ਸਰਵਰ ਤੱਕ ਜਾਣ ਤੋਂ ਪਹਿਲਾਂ form inputs ਨੂੰ ਵੈਲੀਡੇਟ ਕਰਦਾ ਸੀ। ਇਹ ਮਾਊਸ ਹੋਵਰ 'ਤੇ ਤਸਵੀਰਾਂ ਬਦਲਦਾ ਸੀ। ਇਹ ਇੱਕ ਖਿਡੌਣਾ ਸੀ, ਟੂਲ ਨਹੀਂ। Browser implementations ਅਸੰਗਤ ਸਨ, ਇਸ ਲਈ ਡਿਵੈਲਪਰ ਅਕਸਰ Netscape ਅਤੇ Internet Explorer ਲਈ ਵੱਖਰੇ ਕੋਡ ਪਾਥ ਲਿਖਦੇ ਸਨ।
ECMAScript ਰਾਹੀਂ ਮਿਆਰੀਕਰਨ (Standardization) ਨੇ ਉਸ ਰੇਖਾਗ੍ਰਾਫ ਨੂੰ ਬਦਲ ਦਿੱਤਾ। ਸਪੈਸੀਫਿਕੇਸ਼ਨ ਨੇ browser vendors ਨੂੰ ਲਾਗੂ ਕਰਨ ਲਈ ਇੱਕ ਸਾਂਝਾ ਨਿਸ਼ਾਨਾ ਦਿੱਤਾ, ਜਿਸ ਨੇ ਹੌਲੀ-ਹੌਲੀ ਸਭ ਤੋਂ ਮਾੜੀਆਂ ਅਸੰਗਤੀਆਂ ਨੂੰ ਦੂਰ ਕਰ ਦਿੱਤਾ। ਫਿਰ Ajax ਆਇਆ।
Ajax, ਜੋ ਕਿ Asynchronous JavaScript ਅਤੇ XML ਦਾ ਸੰਖੇਪ ਰੂਪ ਹੈ, ਕੋਈ ਇੱਕ ਨਵੀਂ ਤਕਨਾਲੋਜੀ ਨਹੀਂ ਸੀ ਬਲਕਿ ਇੱਕ ਪੈਟਰਨ ਸੀ ਜਿਸ ਨੇ ਮੌਜੂਦਾ ਹਿੱਸਿਆਂ ਨੂੰ ਜੋੜਿਆ ਸੀ। ਮਹੱਤਵਪੂਰਨ ਸਮੱਗਰੀ XMLHttpRequest object ਸੀ, ਜਿਸ ਨੇ ਬ੍ਰਾਊਜ਼ਰ ਨੂੰ ਪੂਰੇ ਪੇਜ ਨੂੰ ਰੀਲੋਡ ਕੀਤੇ ਬਿਨਾਂ ਪਿਛੋਕੜ (background) ਵਿੱਚ ਸਰਵਰ ਤੋਂ ਡਾਟਾ ਮੰਗਣ ਦੀ ਇਜਾਜ਼ਤ ਦਿੱਤੀ। ਜਦੋਂ Google ਨੇ 2005 ਵਿੱਚ Maps ਅਤੇ 2004 ਵਿੱਚ Gmail ਲਾਂਚ ਕੀਤਾ, ਤਾਂ ਉਪਭੋਗਤਾਵਾਂ ਨੇ ਅਚਾਨਕ ਬ੍ਰਾਊਜ਼ਰ ਟੈਬ ਦੇ ਅੰਦਰ ਡੈਸਕਟਾਪ ਵਰਗੀ ਪ੍ਰਤੀਕਿਰਿਆ (responsiveness) ਦਾ ਅਨੁਭਵ ਕੀਤਾ। ਵੈੱਬ ਪੇਜ ਐਪਲੀਕੇਸ਼ਨਾਂ ਬਣ ਗਏ। JavaScript ਹੁਣ ਸਿਰਫ਼ ਇੱਕ ਸਜਾਵਟ ਨਹੀਂ ਰਿਹਾ ਸੀ। ਇਹ ਮੁੱਖ ਭੋਜਨ (main course) ਬਣ ਗਿਆ ਸੀ।
ਰਫ਼ਤਾਰ ਅਤੇ ਅਭਿਲਾਸ਼ਾ
Raw performance ਕਦੇ JavaScript ਦਾ ਸਭ ਤੋਂ ਵੱਡਾ ਮਜ਼ਾਕ ਹੁੰਦੀ ਸੀ। ਸ਼ੁਰੂਆਤੀ interpreters ਹੌਲੀ ਸਨ। ਫਿਰ Google ਨੇ 2008 ਵਿੱਚ Chrome ਦੇ ਨਾਲ V8 engine released ਕੀਤਾ, ਅਤੇ ਮਜ਼ਾਕ ਹੱਸਣਯੋਗ ਨਹੀਂ ਰਿਹਾ। V8 ਨੇ just-in-time compilation ਪੇਸ਼ ਕੀਤਾ, ਜੋ JavaScript ਨੂੰ ਲਾਈਨ-ਦਰ-ਲਾਈਨ ਇੰਟਰਪ੍ਰੇਟ ਕਰਨ ਦੀ ਬਜਾਏ runtime 'ਤੇ ਮਸ਼ੀਨ ਕੋਡ ਵਿੱਚ ਬਦਲਦਾ ਹੈ। ਇਸਨੇ dynamic objects 'ਤੇ ਵੀ property access ਨੂੰ ਤੇਜ਼ ਬਣਾਉਣ ਲਈ hidden classes ਅਤੇ inline caching ਪੇਸ਼ ਕੀਤੀਆਂ। ਹੋਰ ਬ੍ਰਾਊਜ਼ਰਾਂ ਨੇ ਆਪਣੇ ਹਾਈ-ਸਪੀਡ ਇੰਜਣਾਂ ਨਾਲ ਜਵਾਬ ਦਿੱਤਾ, ਅਤੇ ਭਾਸ਼ਾ ਅਚਾਨਕ ਅਸਲ ਕੰਪਿਊਟੇਸ਼ਨ ਲਈ ਕਾਫ਼ੀ ਤੇਜ਼ ਹੋ ਗਈ।
That speed enabled the next shift. Ryan Dahl released Node.js in 2009, stripping V8 out of the browser and wrapping it in an event-driven, non-blocking input-output model. Web servers used to spawn a new thread for every incoming request, which collapsed under heavy concurrency. Node.js handled tens of thousands of simultaneous connections on a single thread using an event loop and asynchronous callbacks. JavaScript spilled off the client and onto the server, into build tools, and eventually into everything else.
The Everywhere Language
Now JavaScript runs in places its creator never imagined.
On the frontend, React and Vue shape how modern interfaces are built. Components update in response to state changes without the browser performing expensive full-page reloads. On the backend, Node.js powers APIs and real-time services, while newer runtimes like Bun experiment with faster package management and built-in bundling.
React Native translates JavaScript code into native platform views, letting teams ship mobile applications for iOS and Android without maintaining two entirely separate codebases in Swift and Kotlin. Electron wraps web technologies inside a Chromium shell to build desktop software, which is how both Slack and Visual Studio Code reach your laptop. The language even sits inside cloud functions and edge computing workers, executing logic milliseconds away from the end user across distributed networks.
The Paradox of Plenty
Ubiquity has a cost. The ecosystem is enormous, and that size breeds anxiety. A new build tool appears before you have finished configuring the last one. Frameworks rise and fall in popularity on timelines that feel seasonal. You can solve almost any problem without leaving the JavaScript world, but you must first choose between a dozen highly opinionated solutions. Dependency trees grow deep and brittle. A package for left-padding arrays can break thousands of downstream projects when it disappears from the registry.
None of this is accidental. JavaScript is messy because the web is messy. It is an organic layer cake of backward compatibility, rushed standards, and competing implementation interests. Yet that same mess is why the language is powerful. The web is everywhere, and because JavaScript lives inside every browser by default, it is the closest thing we have to a universal runtime.
It stopped being a mere scripting language long ago. JavaScript is now a global platform for software, built in ten days, held together by the invisible contract that the web must not break what came before. Learn its scars alongside its strengths, and you are learning the history of the modern internet itself.
