JavaScript
Originally created to “make web pages interactive,” JavaScript is a programming language used to write scripts that run directly within a web page’s HTML. These scripts are executed automatically when the page loads and are provided as plain text, meaning no special preparation or compilation is needed.
In this regard, JavaScript differs significantly from another language called Java.
Why the Name JavaScript?
When JavaScript was first developed, it was originally named “LiveScript.” However, since Java was extremely popular at the time, the decision was made to position JavaScript as a “younger sibling” of Java to capitalize on its success.
Over time, JavaScript became a fully independent language, with its own specification known as ECMAScript, and today, it is not related to Java at all.
Now, JavaScript can be run not only in a browser but also on servers or any device that includes a JavaScript engine.
Browsers contain a built-in engine, sometimes referred to as a “JavaScript virtual machine.”
These engines go by different names, such as:
- V8 (in Chrome, Opera, and Edge)
- SpiderMonkey (in Firefox)
- Other names like “Chakra” for IE, “JavaScriptCore,” “Nitro,” and “SquirrelFish” for Safari, etc.
These terms are important to know because they appear frequently in developer documentation. For example, if a feature is “supported by V8,” it indicates compatibility with Chrome, Opera, and Edge.
How Do Engines Work?
Although the mechanics of engines are complex, their basic functionality is straightforward.
- The engine (embedded in the browser) reads and parses the script.
- It compiles the script into machine code.
- The compiled code runs quickly.
The engine also optimizes the code during the process and continuously refines it while running, based on the data flow.
What Can In-Browser JavaScript Do?
Modern JavaScript is designed to be a “safe” language, meaning it doesn’t provide low-level access to memory or the CPU—features that are unnecessary for browser functionality.
JavaScript’s capabilities vary depending on the environment in which it runs. For example, with Node.js, JavaScript can read and write files or make network requests, which isn’t possible in the browser.
In the browser, JavaScript can interact with web pages, respond to user input, and communicate with web servers. For example, JavaScript can:
- Modify the page’s HTML content, change styles, and add new elements
- Respond to user actions like mouse clicks, pointer movements, and key presses
- Send network requests to servers, handle file uploads/downloads (AJAX, COMET)
- Manage cookies, display messages, and ask users for input
- Store data locally on the client-side using “local storage”
What Can’t JavaScript Do?
For security reasons, JavaScript in the browser has certain limitations. It is restricted to prevent malicious websites from accessing sensitive user information or damaging data.
Some key restrictions include:
- JavaScript can’t read or write arbitrary files from the user’s hard drive, execute programs, or access operating system functions. However, it can work with files in specific, user-controlled scenarios (e.g., by selecting a file via the <input> tag).
- Access to devices like the camera or microphone requires explicit user permission.
- JavaScript in different tabs or windows generally can’t communicate unless they share the same domain. This “Same Origin Policy” protects users from malicious pages trying to steal data from other open tabs.
- JavaScript can easily make requests to the server hosting the current page, but accessing data from other domains requires permission from the remote server via special HTTP headers.
These limitations don’t apply when JavaScript is used outside the browser, like on a server. Modern browsers also support extensions or plugins that may request additional permissions.
What Makes JavaScript Unique?
JavaScript stands out for several reasons:
- It integrates seamlessly with HTML and CSS
- It simplifies complex tasks
- It’s supported by all major browsers and is enabled by default
These factors make JavaScript the most popular language for creating interactive web interfaces. Furthermore, it’s not limited to browsers—it can also be used to create servers, mobile apps, and more.
Even if you use transpiled languages, a strong understanding of JavaScript is essential to fully grasp what’s happening behind the scenes.
About the Course
JavaScript is one of the most widely-used programming languages, driving interactive features on websites and web applications. Whether you’re a beginner or an experienced developer looking to improve your skills, the “JavaScript Basics” course on Udemy is the perfect starting point.
This fast-paced, concise course will teach you the fundamentals in just 86 minutes, covering key concepts like data types, variables, functions, and control flow. You’ll also get hands-on experience by building your own programs from scratch.
The course focuses on practical applications, so you’ll work on real-world exercises, such as creating a simple calculator or dynamic web page. This hands-on approach ensures you not only learn but also develop the skills to start building your own projects.
Designed for learners of all levels, the course instructor, a seasoned JavaScript developer, takes a step-by-step approach that makes it easy to follow, even if you’ve never written code before. Each lesson is clear and concise, with plenty of examples and visual aids to help reinforce the material.
In addition to video lessons, you’ll have access to quizzes, exercises, and downloadable code examples to further solidify your understanding.
By the end of the course, you’ll have a strong foundation in JavaScript, along with the confidence and skills to begin building your own web applications. Whether you’re aiming for a career as a web developer or simply want to learn a valuable skill, this course is a great place to start.
This Course Is For You If:
- You want to become a web developer
- You’re a developer looking to strengthen your JavaScript skills
Skills You’ll Gain:
- Setting up Visual Studio Code for JavaScript
- Using shortcuts and tips to improve productivity in Visual Studio Code
- Understanding the fundamentals of JavaScript and why it’s used
- Grasping how JavaScript works, starting from the basics
- Learning quick coding tips for faster development in Visual Studio Code
Curriculum
- 7 Sections
- 61 Lessons
- 2 Weeks
- Getting Started6
- Basics7
- Operators8
- Control Flow10
- Objects13
- Array11
- Functions6