Javascript.info
“Javascript.info” is a comprehensive online resource for learning JavaScript, covering a wide range of topics from basic to advanced concepts. The content is structured in a beginner-friendly manner, making it accessible for learners of all levels. The website provides detailed explanations, code examples, and interactive exercises to help readers grasp JavaScript fundamentals and enhance their programming skills. With a focus on practical applications and real-world scenarios, “Javascript.info” aims to equip individuals with the knowledge and tools needed to become proficient in JavaScript development.
Coding Style
Our code must be as clean and easy to read as possible. That is actually the art of programming – to take a complex task and code it in a way that is both correct and human-readable. A good code style...
📚 Read more at Javascript.info🔎 Find similar documents
Destructuring assignment
The two most used data structures in JavaScript are Object and Array . Objects allow us to create a single entity that stores data items by key. Arrays allow us to gather data items into an ordered li...
📚 Read more at Javascript.info🔎 Find similar documents
Scheduling: setTimeout and setInterval
We may decide to execute a function not right now, but at a certain time later. That’s called “scheduling a call”. There are two methods for it: setTimeout allows us to run a function once after the i...
📚 Read more at Javascript.info🔎 Find similar documents
Variables
Most of the time, a JavaScript application needs to work with information. Here are two examples: An online shop – the information might include goods being sold and a shopping cart. A chat applicatio...
📚 Read more at Javascript.info🔎 Find similar documents
Objects
As we know from the chapter Data types , there are eight data types in JavaScript. Seven of them are called “primitive”, because their values contain only a single thing (be it a string or a number or...
📚 Read more at Javascript.info🔎 Find similar documents
Arrays
Objects allow you to store keyed collections of values. That’s fine. But quite often we find that we need an ordered collection , where we have a 1st, a 2nd, a 3rd element and so on. For example, we n...
📚 Read more at Javascript.info🔎 Find similar documents
Comparisons
We know many comparison operators from maths. In JavaScript they are written like this: Greater/less than: a b , a < b . Greater/less than or equals: a = b , a <= b . Equals: a == b , please note the ...
📚 Read more at Javascript.info🔎 Find similar documents
Class checking: "instanceof"
The instanceof operator allows to check whether an object belongs to a certain class. It also takes inheritance into account. Such a check may be necessary in many cases. For example, it can be used f...
📚 Read more at Javascript.info🔎 Find similar documents
Code structure
The first thing we’ll study is the building blocks of code. Statements Statements are syntax constructs and commands that perform actions. We’ve already seen a statement, alert('Hello, world!') , whic...
📚 Read more at Javascript.info🔎 Find similar documents
Developer console
Code is prone to errors. You will quite likely make errors… Oh, what am I talking about? You are absolutely going to make errors, at least if you’re a human, not a robot . But in the browser, users do...
📚 Read more at Javascript.info🔎 Find similar documents
Function binding
When passing object methods as callbacks, for instance to setTimeout , there’s a known problem: “losing this ”. In this chapter we’ll see the ways to fix it. Losing “this” We’ve already seen examples ...
📚 Read more at Javascript.info🔎 Find similar documents
Error handling, "try...catch"
No matter how great we are at programming, sometimes our scripts have errors. They may occur because of our mistakes, an unexpected user input, an erroneous server response, and for a thousand other r...
📚 Read more at Javascript.info🔎 Find similar documents