DEV Community

Surya  P
Surya P

Posted on

JavaScript Basics:Arrays,Functions & Callbacks.

*Today, I revised some important JavaScript concepts as part of my web development journey.

  • What I Learned:
  • Array Length (.length) The .length property returns the total number of elements in an array. let marks = [10, 20, 30]; console.log(marks.length); // 3
  • Mixed Data Types in Arrays JavaScript arrays can store different types of data together. const arr = [10, 20, 30, "abc", true];
  • The filter() Method The filter() method creates a new array containing elements that match a given condition. const numbers = [10, 15, 20, 25, 30]; const result = numbers.filter(num => num > 20);

console.log(result); // [25, 30]

  1. Callback Functions A callback is a function passed as an argument to another function.
  2. Arrow Functions (=>) Arrow functions provide a concise way to write functions in JavaScript.

*Conclusion:
Learning and revising these concepts helps me improve my JavaScript knowledge and build a strong foundation in web development.
I will continue learning and building new projects! 💻

Top comments (0)