js

Introduction HTML gives the web page structure and purpose CSS makes it looks aesthetic with styling JS makes the page dynamic and interactive A lightweight, interpreted programming language. it run instantly as a soon it run instantly, it is interpreted and dynamic. it is popular Programs written in JavaScript are called scripts. JavaScript allows you to implement complex interaction on Web pages. you add dynamic interaction with javascript. It is the third layer of standard web technologies (HTML, CSS, JS). JavaScript is different from Java programming language. the relationship between HTML, CSS and javascript is because they are standard of building a website it used .js file extension. Uses of JavaScript adds interactivity to web pages run codes in response to certain events javascript has a powerful application programming interface(API) hence access to numerous complex features e.g get location, mapping, 2d graphics. it is everywhere it can be run anywhere Execution in Js to run it, it can be run by a browser with javascript virtual machine to run js, the jvm can be in a browser(cos all browsers come with a jvm where it is chrome, Safari, mozilla, edge), mobile phone, a server. for chrome, opera and edge they have v8 machine because the v8 is maintained by chrome, for firefox their jvm is spiderMonkey, for internet explorer which is no longer in use theirs is called chakra, for apple we have squirrelfish. How to run javascript Internal js / inline js to run javascript internally external js is tp add js in another file and reference it in the script tag the order is important to debug you use a developer console to check the debugging we have some section in the dev tools, element, network, console, sources, performance, memory. A statement carry out an action alert("click me") comments in javascript thare human readable text that does not rendered on the page, it is ignored by the interpreter *// single line / / multi- line comments * variable is a name storage for a value or data let firstName = "Risisng" let surname = "heloo" Uses of JavaScript Adds interactivity to web pages Run codes in response to certain events JavaScript has a powerful Application Programming Interface (APIs), hence access to numerous complex features What is even more exciting however is the functionality built on top of the client-side JavaScript language. So-called Application Programming Interfaces (APIs) provide you with extra superpowers to use in your JavaScript code. APIs are ready-made sets of code building blocks that allow a developer to implement programs that would otherwise be hard or impossible to implement. They do the same thing for programming that ready-made furniture kits do for home building. There are two types of APIs available: 1.Browser APIs: Built and shipped with Browsers 2.Third party APIs: Not built into the browser by default, and you generally have to grab their code and information from somewhere on the Web. For example: Google maps API, Twitter API JavaScript can run on: Browsers, using the JavaScript Virtual Machine (JVM). Servers, using runtimes like Nodejs Any devices that have the Javascript engine JS Execution JavaScript can execute not only in the browser, but also on the server, or actually on any device that has a special program called the JavaScript engine. The browser has an embedded engine sometimes called a “JavaScript virtual machine”. Different engines have different “names” for their JVM. The terms above are good to remember because they are used in developer articles on the internet. We’ll use them too. For instance, if “a feature X is supported by V8”, then it probably works in Chrome, Opera and Edge. Different platforms have different “names” for their JVM V8 – in Chrome, Opera and Edge. SpiderMonkey – in Firefox. Chakra” for IE Nitro” and “SquirrelFish” for Safari, etc. Embedding JS JavaScript is applied to your HTML page in a similar manner to CSS. Whereas CSS uses elements to apply external stylesheets and elements to apply internal stylesheets to HTML, JavaScript only needs one friend in the world of HTML — the element. Adding JavaScript to your Webpage Internal JavaScript: JS code added inside HTML files External JavaScript: External JS code linked in HTML file Internal Javascript Write and run JS inline HTML by saving the file and loading in the browser. Order matters, so if you add the script before the button, you get an error. Show an example here Show an example of the “DOMContentLoaded” event. Order does not matter here, as script code is executed after HTML content is loaded. External Javascript This is generally a good thing in terms of organizing your code and making it reusable across multiple HTML files. Plus, the HTML is easier to read without huge chunks of script dumped in it. Note the defer option? I does the same

Feb 19, 2025 - 13:20
 0
js

Introduction

  • HTML gives the web page structure and purpose
  • CSS makes it looks aesthetic with styling
  • JS makes the page dynamic and interactive

  • A lightweight, interpreted programming language.
    it run instantly as a soon it run instantly, it is interpreted and dynamic. it is popular

  • Programs written in JavaScript are called scripts.

  • JavaScript allows you to implement complex interaction on Web pages. you add dynamic interaction with javascript.

  • It is the third layer of standard web technologies (HTML, CSS, JS).

  • JavaScript is different from Java programming language.

  • the relationship between HTML, CSS and javascript is because they are standard of building a website

  • it used .js file extension.

Uses of JavaScript

  • adds interactivity to web pages
  • run codes in response to certain events
  • javascript has a powerful application programming interface(API) hence access to numerous complex features e.g get location, mapping, 2d graphics.
  • it is everywhere it can be run anywhere

Execution in Js

  • to run it, it can be run by a browser with javascript virtual machine to run js, the jvm can be in a browser(cos all browsers come with a jvm where it is chrome, Safari, mozilla, edge), mobile phone, a server. for chrome, opera and edge they have v8 machine because the v8 is maintained by chrome, for firefox their jvm is spiderMonkey, for internet explorer which is no longer in use theirs is called chakra, for apple we have squirrelfish.

How to run javascript

  • Internal js / inline js to run javascript internally
  • external js is tp add js in another file and reference it in the script tag the order is important
  • to debug you use a developer console to check the debugging we have some section in the dev tools, element, network, console, sources, performance, memory.
  • A statement carry out an action
    alert("click me")

  • comments in javascript thare human readable text that does not rendered on the page, it is ignored by the interpreter

*// single line
/
/ multi- line comments *

  • variable is a name storage for a value or data
let firstName = "Risisng"
let surname = "heloo"

Uses of JavaScript

  • Adds interactivity to web pages
  • Run codes in response to certain events
  • JavaScript has a powerful Application Programming Interface (APIs), hence access to numerous complex features
  • What is even more exciting however is the functionality built on top of the client-side JavaScript language. So-called Application Programming Interfaces (APIs) provide you with extra superpowers to use in your JavaScript code.
  • APIs are ready-made sets of code building blocks that allow a developer to implement programs that would otherwise be hard or impossible to implement. They do the same thing for programming that ready-made furniture kits do for home building.
    There are two types of APIs available:

  • 1.Browser APIs: Built and shipped with Browsers

  • 2.Third party APIs: Not built into the browser by default, and you generally have to grab their code and information from somewhere on the Web. For example: Google maps API, Twitter API

  • JavaScript can run on:

  • Browsers, using the JavaScript Virtual Machine (JVM).

  • Servers, using runtimes like Nodejs

  • Any devices that have the Javascript engine

JS Execution

  • JavaScript can execute not only in the browser, but also on the server, or actually on any device that has a special program called the JavaScript engine.
  • The browser has an embedded engine sometimes called a “JavaScript virtual machine”. Different engines have different “names” for their JVM.
  • The terms above are good to remember because they are used in developer articles on the internet. We’ll use them too. For instance, if “a feature X is supported by V8”, then it probably works in Chrome, Opera and Edge.
    Different platforms have different “names” for their JVM

  • V8 – in Chrome, Opera and Edge.

  • SpiderMonkey – in Firefox.

  • Chakra” for IE

  • Nitro” and “SquirrelFish” for Safari, etc.

Embedding JS

  • JavaScript is applied to your HTML page in a similar manner to CSS. Whereas CSS uses elements to apply external stylesheets and

    This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies.