Raj's Code dump
57 subscribers
69 photos
3 videos
41 files
37 links
Hello,
Here to post all gg sources.

Join : connected chat For discussion and doubts.
Download Telegram
waybar for windows
โค3
WINbar

WINbar is a lightweight, customizable Windows top bar that brings quick access to essential system controls, live performance metrics, and productivity shortcuts in a clean, always-accessible. inspired by Linux's Waybar.

๐Ÿ”— Links:
- Download
- Screenshots
- Source code
Developer: Raj Srivastava

โค๏ธ Support the Project

If this project makes your life easier, here are a few quick ways to show some love:
โญ๏ธ Star the repo/app
โ˜•๏ธ Buy a coffee for the developer
๐Ÿ›  Contribute code, issues, or pull-requests


tags: #windows #customisation #winbar
JavaScript tutorial ??
โค2๐Ÿ‘1
JavaScript is a programming language that runs in web browsers (and on servers via Node.js). It's used to make web pages interactive, handling clicks, updating content, validating forms, fetching data, and much more.

Where to Write JavaScript ?
ยป Easiest way to start: open your browser's DevTools console (F12 or right-click โ†’ Inspect โ†’ Console) and type code directly.
ยป In an HTML file
Variables
let name = "Alex"; // can be reassigned
const age = 25; // cannot be reassigned
var oldWay = "avoid"; // outdated, avoid using
Data Types
let str = "hello";        // string
let num = 42; // number
let bool = true; // boolean
let arr = [1, 2, 3]; // array
let obj = { name: "Alex", age: 25 }; // object
let nothing = null; // intentional empty value
let notDefined; // undefined
Operators
5 + 3        // 8
10 - 4 // 6
3 * 4 // 12
10 / 2 // 5
10 % 3 // 1 (remainder)

5 === 5 // true (strict equality โ€” use this)
5 == "5" // true (loose equality โ€” avoid this)
5 !== 3 // true

true && false // AND
true || false // OR
!true // NOT
Conditionals
let age = 18;

if (age >= 18) {
console.log("Adult");
} else if (age >= 13) {
console.log("Teenager");
} else {
console.log("Child");
}
Functions
// Regular function
function greet(name) {
return "Hello, " + name;
}

// Arrow function (modern, common)
const greet2 = (name) => {
return "Hello, " + name;
};

// Short arrow function
const greet3 = name => `Hello, ${name}`;

console.log(greet("Alex")); // Hello, Alex
Arrays
let fruits = ["apple", "banana", "cherry"];

fruits.push("date"); // add to end
fruits.pop(); // remove from end
fruits[0]; // "apple"
fruits.length; // 4

fruits.forEach(f => console.log(f));
let upper = fruits.map(f => f.toUpperCase());
let long = fruits.filter(f => f.length > 5);
Objects
let person = {
name: "Alex",
age: 25,
greet() {
console.log("Hi, I'm " + this.name);
}
};

console.log(person.name); // dot notation
console.log(person["age"]); // bracket notation
person.greet();
Loops
for (let i = 0; i < 5; i++) {
console.log(i);
}

let i = 0;
while (i < 5) {
console.log(i);
i++;
}

for (let fruit of fruits) {
console.log(fruit);
}
This media is not supported in your browser
VIEW IN TELEGRAM
Variables & Data Types (Deep Dive)

Declaring Variables
JavaScript has three ways to declare a variable:

let score = 10;      // block-scoped, reassignable
const name = "Alex"; // block-scoped, NOT reassignable
var old = "avoid"; // function-scoped, legacy โ€” avoid

Why avoid var? It's scoped to the whole function, not the block, which causes bugs:

if (true) {
var x = 5;
}
console.log(x); // 5 โ€” leaked outside the if-block!

if (true) {
let y = 5;
}
console.log(y); // Error: y is not defined โ€” correctly contained

Rule of thumb: use const by default, switch to let only when you know the value will change. Never use var.
const doesn't mean "unchangeable data"... it means "unreassignable variable"

This trips people up:
const arr = [1, 2, 3];
arr.push(4); // โœ… totally fine โ€” mutating contents
console.log(arr); // [1, 2, 3, 4]

arr = [9, 9, 9]; // โŒ Error โ€” can't reassign the variable itself

Same with objects:
const person = { name: "Alex" };
person.name = "Sam"; // โœ… fine, mutating a property
person = {}; // โŒ Error

The Data Types
JavaScript has two categories: primitives and objects.
Primitives (copied by value):
let s = "hello";       // string
let n = 42; // number (no separate int/float โ€” all one type)
let b = true; // boolean
let u; // undefined โ€” declared but no value assigned
let nul = null; // null โ€” intentional "nothing"
let sym = Symbol("id"); // symbol โ€” rarely needed as a beginner
let big = 123456789012345678901234567890n; // BigInt โ€” rarely needed at first

Objects (copied by reference, important distinction):
let obj = { key: "value" };
let arr = [1, 2, 3];
let func = function() {};

Value vs Reference, a common source of bugs
// Primitives: copying makes an independent copy
let a = 5;
let b = a;
b = 10;
console.log(a); // 5 โ€” unaffected

// Objects: copying copies the REFERENCE, not the data
let obj1 = { value: 5 };
let obj2 = obj1;
obj2.value = 10;
console.log(obj1.value); // 10 โ€” obj1 changed too! Same object in memory.

Type Checking
typeof "hello"     // "string"
typeof 42 // "number"
typeof true // "boolean"
typeof undefined // "undefined"
typeof null // "object" โ€” this is a famous JS quirk/bug, just memorize it
typeof {} // "object"
typeof [] // "object" โ€” arrays are objects too
typeof function(){} // "function"

Type Coercion (JS auto-converting types)
This is one of JS's most confusing.. but important.. behaviors:
"5" + 3      // "53"  โ€” number gets converted to string, then concatenated
"5" - 3 // 2 โ€” string gets converted to number for subtraction
"5" * "2" // 10 โ€” both converted to numbers
true + 1 // 2 โ€” true becomes 1
false + 1 // 1 โ€” false becomes 0
"" + null // "null"

This is exactly why we use === (strict equality) instead of == (loose equality, which coerces types):
5 == "5"    // true  โ€” coerces "5" to 5 first, dangerous
5 === "5" // false โ€” different types, no coercion, safer

null == undefined // true
null === undefined // false

Practice exercise... try to predict the output before running these:
console.log(1 + "1");
console.log(1 + 1 + "1");
console.log("1" + 1 + 1);
console.log(true + true);
console.log([] + []);
console.log([] + {});

Try guessing those, then let me know your answers.
โค2๐Ÿ‘2