JavaScript Notes
Live Class Notes
JavaScript
JavaScript is an interpreted, lightweight programming language. It's a webpage scripting language. It is intended for the development of network-centric applications. Node.js, Adobe Acrobat, ApacheCouchDB etc also uses javascript. It's open and cross-platform. JavaScript is a single-threaded, prototype-based, dynamic language that supports object-oriented, imperative, and declarative (e.g. functional programming) programming styles.
JS introduction
Introduction to JAVASCRIPT
JavaScript (js) is a light-weight object-oriented programming language which is used by several websites for scripting the webpages. It is an interpreted, full-fledged programming language that enables dynamic interactivity on websites when applied to an HTML document. It was introduced in the year 1995 for adding programs to the webpages in the Netscape Navigator browser. Since then, it has been adopted by all other graphical web browsers. With JavaScript, users can build modern web applications to interact directly without reloading the page every time. The traditional website uses js to provide several forms of interactivity and simplicity. Javascript is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain.
Execution Context and Call Stack
JavaScript in Browsers
All the modern browsers come with built-in support for JavaScript. Frequently, you may need to enable or disable this support manually. This chapter explains the procedure of enabling and disabling JavaScript support in your browsers: Internet Explorer, Firefox, chrome, and Opera.
JavaScript is activated by default in most of browsers, if not you can follow these steps to activate.
- Click the Chrome menu at the top right hand corner of your browser.
- Select Settings.
- Click Show advanced settings at the end of the page.
- Under the Privacy section, click the Content settings button.
- In the "Javascript" section, select "Do not allow any site to run JavaScript" or "Allow all sites to run JavaScript (recommended)".
JavaScript in Chrome
- Open a new tab → type about: config in the address bar.
- Then you will find the warning dialog. Select I’ll be careful, I promise!
- Then you will find the list of configure options in the browser.
- In the search bar, type javascript.enabled.
- There you will find the option to enable or disable javascript by right-clicking on the value of that option → select toggle.
JavaScript in Firefox
Setting up the development environment
Because of its wide range of applications, you can run JavaScript in several ways:
- Using console tab of web browsers
- Using Node.js
- By creating web pages
Here, we are going to use JavaScript in developing a web application. So, we must have at least two things, a browser, and an editor to write the JavaScript code.
Although we also need a webserver to run a web application, but we will use a single HTML web page to run our JavaScript code. So, no need to install it for now. We will be using browser to execute JavaScript.
- Browser :
The web browser was the original JavaScript runtime environment, and it's still the most dominant. JavaScript running in the browser is far more ubiquitous than JavaScript running anywhere else. Almost every browser has a JavaScript engine built into it. - VS Code :
Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git