JavaScript ,it’s a Wonderful programming language to learn for beginners ,it’s also a horrible programming language to learn for beginners on one hand .You can build almost anything with it and get a job anywhere if you master it on the other hand it’s weird ugly and surrounded by a dystopian Wasteland of Frameworks and libraries
Welcome to this JavaScript article where over the next few minutes you’ll learn few different things you need to know about JavaScript like how to use it where to use it and why it is the way it is . By the end of this article you’ll be able to build
- A website.
- A mobile app.
- A desktop app.
- A server.
- An operating system artificial intelligence.
- And all kinds of other stuff you shouldn’t build with it.
It was created in 1993 by Brendan Eich at Netscape. At the time the web browser was cutting edge technology that connected everybody on the planet via the World Wide Web and now that I’ve gotten on the internet I’d rather be on my computer than doing just about anything at the time websites were completely static with pure HTML.
JavaScript was designed as an easy to use high level language to help developers make these websites interactive today it’s arguably the most popular language in the world and its standard implementation is called ECMAScript and is the default language in all web browsers in fact it’s the only code that natively runs in a browser aside from WebAssembly , however the browser is not the only runtime and you can also run JavaScript code on a server thanks to tools like node.js and Dino.
JavaScript variables
There are several different ways to Define variables the most common of which today is
- let :- Start by giving it a name which will normally be in CamelCase then assign a value to it . It’s a dynamically typed language which means no data type annotations are necessary in this case I’ve assigned a number which is one of the seven primitive data types built into the language however we don’t need to assign the variable a value right now because it can be reassigned later without an assignment.
let CamelCase = 5
- var :- I would recommend ignoring its existence altogether
- const :-The keyword
const
is a little misleading. It does not define a constant value. It defines a constant reference to a value.
Because of this , things you cannot do are:
- Reassign a constant value
- Reassign a constant array
- Reassign a constant object
While u still can :
- Change the elements of constant array
- Change the properties of constant object
Understanding JavaScript in depth:
Memory Management
- JavaScript employs automatic garbage collection, which effectively manages memory by deallocating objects that are no longer referenced within the codebase, ensuring efficient memory usage.
Arrow Functions
- Arrow functions in JavaScript offer a unique behavior where they do not possess their own ‘this’ context,making them particularly suitable for function expressions and more concise code.
Object-Oriented Programming
- JavaScript introduces support for object-oriented programming through the ‘class’ keyword. Which provides syntactic sugar for prototypal inheritance, a mechanism where objects inherit properties and behaviors from other objects, establishing a flexible and memory-efficient approach to building complex applications.
Front-End Frameworks
- Front-end frameworks in JavaScript revolutionize web development by promoting declarative programming . The user interface is dynamically generated based on data inputs, offering a more intuitive and maintainable way to build interactive websites.
Node.js
- Node.js, a server-side JavaScript runtime environment, extends the language’s versatility beyond browser-based applications, enabling developers to create robust, scalable back-end solutions for handling complex data processing and server-side logic. Do read Can I learn NodeJS without js to learn more!
DOM Manipulation
- JavaScript operates within the browser’s Document Object Model (DOM), enabling seamless interaction with HTML elements.
Asynchronous Programming/ Promises
- Asynchronous functions in JavaScript, enhanced by the ‘await’ keyword, streamline the handling of asynchronous operations, enabling developers to write cleaner and more readable code .
Cross-Platform Development with Electron
- Frameworks like Electron leverage Node.js to bridge the gap between desktop and web development, empowering developers to build cross-platform desktop applications using HTML, CSS, and JavaScript.