Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Javascript lesson 2 The if construct

16/04/2025, by Ivan

In this lesson, we will explore how the if statement can be used in JavaScript. The syntax in JavaScript is quite similar to PHP (both were designed with C++ programmers in mind), so you can also read about if statements in this PHP lesson:

PHP Lessons – Lesson 8 – If Statement

As an example, let's take a look at the following if structure:

var x = 15;
var y = 7;

if (x > y) {
  alert('x is greater than y'); // if x is greater than y
} else {
  alert('x is less than y'); // if x is not greater than y
}

The general form of an if statement is as follows:

if (condition) {
  action if the condition is true
} else {
  action if the condition is false
}