Category: 1. Javascript Basic

  • JavaScript Arrow Functions

    Arrow functions are one of the popular features of ES6 syntax for writing JavaScript function expressions. Arrow function expressions cannot be used as constructors. Arrow functions also called “fat arrow” functions, there are a more concise syntax for writing function expressions. By using arrow functions, we avoid having to type the function keyword, return keyword and curly brackets. This creates a function func…

  • JavaScript Function Expressions

    There are two different ways of creating functions in JavaScript. We can use function declaration and function expression. The difference between them is the function name, which can be omitted in function expressions to create anonymous functions. Here is the syntax for Function Declaration: And this is the syntax for Function Expression: The function is assigned to the variable, like any other value. No matter…

  • JavaScript Functions

    Like every programming language, JavaScript also supports the use of functions. JavaScript functions are the main blocks of code designed to perform a particular task. Functions allow the code to be called many times without repetition. Function Declaration We can create functions in JavaScript using a function declaration that looks like this: As you see in the…

  • JavaScript Loops: while and for

    While writing a program, you can meet a situation when you need to execute an action repeatedly. In that case, you would need to write loop statements, which let us reduce the number of lines. In other words, loops offer a quick and easy way to do something repeatedly. For example, if you want to type…

  • Javascript Switch

    The switch statement is used to represent various actions based on different conditions. It can replace multiple if checks and gives a more descriptive way for comparing a value with multiple variant. To perform a multiway branch, you can use multiple else…if statements, as in the previous chapter, but it is not the best way. It is better to use a switch statement…

  • Javascript Conditional Operators: if, ‘?’

    There are five conditional statements in JavaScript: The “if” Statement The if(…) statement is the most fundamental of the conditional statements, as it evaluates whether a statement is true or false, and runs only if the statement returns true. In case of a false result the code block will be ignored and the program will skip to the next…

  • JavaScript Logical Operators

    Logical operators are typically used to determine the logic between variables or values. They return a Boolean value of true or false depending on the evaluation. There are three logical operators in JavaScript: || (OR), && (AND), ! (NOT). They are called “logical”, but can be applied to values of any type, their result can also be of any type. || (OR) The OR operator is performed…

  • Comparison Operators

    You know comparison operators from math class, but let’s refresh your knowledge: Greater than operator (a > b) returns true if the left operand is greater than the right operand. Syntax: Example of the greater than operator: Less than operator (a < b) returns true if the left operand is less than the right operand. Syntax: Example…

  • JavaScript Operators

    JavaScript Operators We know many operators from school: addition +, multiplication *, subtraction -, and so on. In this chapter, we will talk about the aspects of operators that are not covered by school arithmetic. Terms: “unary”, “binary”, “operand” There is some terminology, which you should know before going on. There are two different operators in the examples…

  • Javascript Simple Actions alert, prompt, confirm

    In this chapter of the tutorial you will get familiar with the browser functions. JavaScript has three kind of boxes: alert, prompt, confirm and console.log. Let’s talk about them in details. JavaScript Alert: Definition and Usage alert() method shows an alert dialog with the optional detailed content and an OK button. An alert box usually used in case we want to…