Skip to main content

Featured Post

What You Need to Know About Salesforce's Latest Security Release

  A practical breakdown for admins, developers, and security teams Salesforce ships security updates on a regular cadence, and every release brings a fresh wave of patches, deprecations, and new defensive features that admins need to act on quickly. If you're running Sales Cloud, Service Cloud, Experience Cloud, or any custom Lightning app, ignoring a security release isn't an option — these updates frequently include critical fixes that protect your org from credential leaks, permission escalation, and data exfiltration. Here's what you should focus on in the latest release, and how to roll changes out without breaking your production environment. 1. Critical Updates You Should Enable Now Salesforce typically bundles its most important security changes as Critical Updates or Release Updates that auto-enforce on a specific date. Missing the enforcement deadline means the platform flips the switch for you — sometimes with unintended downstream effects on integrations...

Javascript basics in 20 min


 











1. Variables

  • var, let, and const are used to declare variables.
    var x = 5; // Function-scoped (old way, use with caution) let y = 10; // Block-scoped (preferable) const z = 15; // Block-scoped, cannot be reassigned
  • const is used when you know the value won’t change.

2. Data Types

  • Primitive Types: string, number, boolean, null, undefined, symbol, bigint

    let name = "John"; // String let age = 25; // Number let isActive = true; // Boolean let data = null; // Null let notAssigned; // Undefined
  • Reference Types: Objects, Arrays, Functions.

    let person = { name: "John", age: 25 }; // Object let numbers = [1, 2, 3]; // Array

3. Functions

  • Functions can be declared and invoked:

    function greet(name) { return "Hello, " + name; } console.log(greet("Alice"));
  • Arrow Functions (ES6):

    const greet = (name) => "Hello, " + name; console.log(greet("Bob"));

4. Control Flow (if-else, switch)

  • If-else:

    let age = 18; if (age >= 18) { console.log("Adult"); } else { console.log("Minor"); }
  • Switch:

    let day = 3; switch (day) { case 1: console.log("Monday"); break; case 2: console.log("Tuesday"); break; case 3: console.log("Wednesday"); break; default: console.log("Invalid day"); }

5. Loops

  • For loop:

    for (let i = 0; i < 5; i++) { console.log(i); }
  • While loop:

    let i = 0; while (i < 5) { console.log(i); i++; }
  • For...of loop (for iterating arrays):

    let arr = [10, 20, 30]; for (let num of arr) { console.log(num); }

6. Arrays and Objects

  • Arrays are ordered collections:

    let fruits = ["apple", "banana", "cherry"]; console.log(fruits[0]); // "apple"
  • Objects are key-value pairs:
    let person = { name: "John", age: 30 }; console.log(person.name); // "John"

7. Events (Browser-Specific)

  • JavaScript can interact with the DOM (Document Object Model) to handle events:

    document.getElementById("myButton").onclick = function() { alert("Button clicked!"); };

8. Array Methods

  • map (creates a new array by applying a function):

    let numbers = [1, 2, 3]; let doubled = numbers.map(num => num * 2); console.log(doubled); // [2, 4, 6]
  • filter (creates a new array with values passing the test):

    let numbers = [1, 2, 3, 4]; let even = numbers.filter(num => num % 2 === 0); console.log(even); // [2, 4]

9. Error Handling (Try-Catch)

  • Try-Catch blocks are used for error handling:

    try { let result = riskyFunction(); } catch (error) { console.log("Error: " + error.message); }

10. ES6 Features

  • Template Literals (for string interpolation):

    let name = "John"; console.log(`Hello, ${name}!`);
  • Destructuring:

    let person = { name: "John", age: 30 }; let { name, age } = person; console.log(name, age); // John 30

11. Promises and Async-Await (for Asynchronous Code)

  • Promise:

    let promise = new Promise((resolve, reject) => { let success = true; if (success) { resolve("Success!"); } else { reject("Error!"); } }); promise.then(result => console.log(result)).catch(error => console.log(error));
  • Async-Await (modern approach to handling promises):

    async function fetchData() { let response = await fetch('https://api.example.com'); let data = await response.json(); console.log(data); } fetchData();

12. Object-Oriented Programming (OOP)

  • Classes:

    class Car { constructor(make, model) { this.make = make; this.model = model; } drive() { console.log(`${this.make} ${this.model} is driving`); } } const car = new Car("Toyota", "Corolla"); car.drive();





Comments

Popular posts from this blog

Understanding SQL Query Execution Order

When writing SQL queries, understanding the execution order is crucial for writing efficient and optimized code. Many beginners assume that queries execute in the order they are written, but in reality, SQL follows a specific sequence of execution. SQL Execution Order SQL queries run in the following order: 1️⃣ FROM + JOIN 2️⃣ WHERE 3️⃣ GROUP BY 4️⃣ HAVING 5️⃣ SELECT (including window functions) 6️⃣ ORDER BY 7️⃣ LIMIT Let’s break down each step with examples. 1. FROM + JOIN (Data Retrieval) The SQL engine first retrieves data from the specified table(s) and applies any JOIN operations. 🔹 Example: SELECT employees.name, departments.department_name FROM employees JOIN departments ON employees.department_id = departments.id; Here, the JOIN happens before any filtering ( WHERE ) or grouping ( GROUP BY ). 2. WHERE (Filtering Data) Once data is retrieved, the WHERE clause filters rows before aggregation occurs. 🔹 Example: SELECT * FROM employees WHERE salary > 50000 ; Thi...

Best Practices for Securing Personal and Business Data in 2025

In today’s digital landscape, cybersecurity is more critical than ever. With increasing cyber threats, data breaches, and privacy concerns, individuals and businesses must take proactive steps to secure their data. This guide outlines the most effective security practices for 2025. 1. Implement Strong Authentication Measures Passwords alone are no longer sufficient to protect sensitive accounts. Instead, consider: ✅ Multi-Factor Authentication (MFA): Require users to verify their identity using an additional factor, such as an SMS code, authenticator app, or biometric authentication. ✅ Passkeys & Password Managers: Use passkeys where available and store strong, unique passwords in a secure password manager. 2. Encrypt Sensitive Data Encryption ensures that even if data is stolen, it remains unreadable without the decryption key. 🔹 Use end-to-end encryption (E2EE) for messages and emails. 🔹 Encrypt stored data on cloud services, external drives, and local machines. 🔹 Consider ...

Top 5 React.js Performance Optimization Techniques for 2025

React.js continues to dominate the front-end development landscape due to its flexibility, component-based architecture, and performance. However, as applications grow, performance issues can emerge, affecting user experience. Here are the top five performance optimization techniques every React developer should consider in 2024. 1. Use React.memo for Component Memoization React.memo is a higher-order component that prevents unnecessary re-renders by memoizing the result. It only re-renders when props change, improving performance for functional components that rely on the same data. import React from 'react';  const ExpensiveComponent = React.memo(({ data }) => {      console.log('Rendering ExpensiveComponent');      return <div>{data}</div>;  }); export default ExpensiveComponent; 2. Implement Code Splitting with React.lazy and Suspense Code splitting reduces the initial load time by splitting the code into smaller bundles. React...