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 5 Arrays, Functions for Working with Arrays

16/04/2025, by Ivan

In this lesson, we’ll explore another JavaScript data type: arrays. We’ll also look at some functions for working with strings and arrays. The rest of the functions will be covered in the following lessons. For an introduction to arrays, you can check out the materials on PHP arrays:

PHP Lessons – Lesson 10 – Arrays

PHP Lessons – Lesson 11 – String and Array Functions

join() Method

The join() method combines all elements of an array into a single string, separated by a specified delimiter. If no delimiter is provided, a comma is used by default.

let fruits = ["Apple", "Banana", "Cherry"];
let result = fruits.join(" - ");
console.log(result); // "Apple - Banana - Cherry"

split() Method

The split() method splits a string into an array of substrings based on a specified delimiter.

let text = "one,two,three";
let parts = text.split(",");
console.log(parts); // ["one", "two", "three"]

length Property

The length property returns the number of elements in an array or the number of characters in a string.

let arr = [10, 20, 30];
console.log(arr.length); // 3

let str = "Hello";
console.log(str.length); // 5