Devlog - 2025-12-03
π What I Did
- Title case conversion using for loops and maps.
- Inventory Management.
- Codewars.
π§ What I Learned
- Boolean - converter function.
- boolean - data type.
typeof true // "boolean"
typeof false // "boolean"
Boolean(10) // true
Boolean(0) // false
Boolean("hi") // true
Boolean("") // false
Boolean(null) // false
Boolean(true) // true
Class
| Use Case | Better Choice |
|---|---|
| Object blueprints | β
class |
| Utilities / helpers | β
function |
| Modern projects | β
class |
| Legacy code | β
function |
- class is just a blueprint for creating objects.
class Car {
constructor(name, speed) {
this.name = name;
this.speed = speed;
}
}
const car1 = new Car("BMW", 120);
const car2 = new Car("Audi", 150);
- constructor runs automatically when you create a new object.
- properties - variables that belong to the object.
- methods - function inside a class.
- this - means this current object.
| Use Case | Use Class? |
|---|---|
| Many similar objects | β |
| Game characters | β |
| API models | β |
| Data structures | β |
| One small object | β |
| Simple helper function | β |
module- provides a powerful way to organize and structure js.
import anyName from './module.js';
π₯ Whatβs Next
- mini projects.
- theory.
| β Previous | Next β |