DeveloperBreeze

Javascript Programming Tutorials, Guides & Best Practices

Explore 93+ expertly crafted javascript tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Non-Primitive Data Types (Objects, Arrays, and Functions)

Tutorial December 11, 2024
javascript

  const add = function (a, b) {
    return a + b;
  };
  console.log(add(3, 5)); // 8
  • Arrow Functions (ES6):

JavaScript DSA (Data Structures and Algorithms) Tutorial: A Beginner's Guide

Tutorial August 30, 2024
javascript

class Stack {
    constructor() {
        this.items = [];
    }

    push(element) {
        this.items.push(element);
    }

    pop() {
        if (this.isEmpty()) return "Underflow";
        return this.items.pop();
    }

    peek() {
        return this.items[this.items.length - 1];
    }

    isEmpty() {
        return this.items.length === 0;
    }

    printStack() {
        let stackString = "";
        for (let i = 0; i < this.items.length; i++) {
            stackString += this.items[i] + " ";
        }
        return stackString;
    }
}

let stack = new Stack();
stack.push(10);
stack.push(20);
stack.push(30);
console.log(stack.printStack()); // Output: 10 20 30
stack.pop();
console.log(stack.printStack()); // Output: 10 20

A queue is a FIFO (First In, First Out) data structure. The first element added is the first one to be removed.