DEV Community

Surya  P
Surya P

Posted on

javascript Learning:Objects and Arrows Functions.

Today, I spent some time revising two important JavaScript concepts: Objects and Arrow Functions.

  1. JavaScript Objects JavaScript objects are used to store related data and functionality together using key-value pairs. Objects can also contain methods to perform specific actions. For example: const mobile = { brand: "Vivo", price: 15000, network: "5G",

browse: function () {
console.log("Browsing...");
}
};
I also practiced creating objects for different bikes:
const TVS = {
model: "XL-100",
price: 99000,
cc: 100,

drive: function () {
console.log("Speed - 70 km/h");
}
};

const bajaj = {
model: "Pulsar",
price: 150000,
cc: 150,

drive: function () {
console.log("Speed - 120 km/h");
}
};
This helped me understand how properties and methods can be organized inside an object.

  1. Arrow Functions I also revised Arrow Functions, which provide a shorter and cleaner way to write function expressions in JavaScript. The basic syntax is: (param1, param2) => expression; For example: const add = (i, j) => i + j; This practice helped me understand how JavaScript objects and functions work together and made my fundamentals stronger. I'm continuing my JavaScript learning journey and looking forward to learning more concepts and building projects.

Top comments (0)