Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 2.74 KB

class-06.md

File metadata and controls

66 lines (43 loc) · 2.74 KB

JavaScript

https://code-maven.com/introduction-to-javascript

We can distinguish 3 major parts of what we usually refer to as "JavaScript"

  1. The language itself. This is fairly standard among the various environments, both in the various browsers and in the various server-side environments.
  2. The DOM API - how the language can interact with the various parts of a web page while in the browser. While in this respect the various browsers are getting closer to each other they still differ. Several libraries, most prominently JQuery, is trying to provide a unified API.
  3. The server API (or just API) provided by Node.js or one of the other server-side systems.

So what can it really do?

The core client-side JavaScript language consists of some common programming features that allow you to do things like:

  • Store useful values inside variables.
  • Operations on pieces of text (known as "strings" in programming).
  • Running code in response to certain events occurring on a web page. We used a click event in our example above to detect when the label is clicked and then run the code that updates the text label.
  • And much more!

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 — it is much easier to take ready-cut panels and screw them together to make a bookshelf than it is to work out the design yourself, go and find the correct wood, cut all the panels to the right size and shape, find the correct-sized screws, and then put them together to make a bookshelf.

Browser APIs are built into your web browser, and are able to expose data from the surrounding computer environment, or do useful complex things.

Third party APIs are not built into the browser by default, and you generally have to grab their code and information from somewhere on the Web. For example:

JavaScript running order

When the browser encounters a block of JavaScript, it generally runs it in order, from top to bottom.

Script Tag

  • Browser executes the code
  • Front end Frameworks
  • JS is interpreted language.
  • Read line by line top to bottom
  • Node JS- back end

Fast- JS Faster - GO Fastest - C++ Primitives and compounds

Variables

4 ways to Declare a JavaScript Variable: 1.) Var 2.) Let 3.) Const 4.) Using nothing

Var should be let and const

Arrays and objects

The DOM - Structure in HTML

C-Like language

Coding language of the web that creates dynamic content

Creates conditionals If, then Orchestrate the logic Operators- perform arithmetic