DEV Community

Kartik
Kartik

Posted on • Edited on

Javascript concepts

  1. How to access value when key name comes from a variable (V) in js object(O)? Using square bracket ([]). For example: O[V]
  2. Array(count).fill() — create a array of size count and fill it with undefined number can be used when for .map() or using other array properties.
  3. Array sorting — [].sort(() => {return boolean}) — conditional sorting js
  4. const frequencyMap = new Map(); Eg: Map(4) { ‘a’ => 7, ‘b’ => 5, ‘e’ => 5, ‘c’ => 2 } — Properties -> — has -> to check if element exist — set -> to add the element — enteries -> to search
  5. ?? — nullish coalescing operator — Returns right handside value (defaultVal) if left handside value (someVal) is null or undefined — someVal ?? defaultVal
  6. Javascript replace function single replace — str.replace(/string/, ‘replacement’) global replace — str.replace(/string/g, ‘replacement’) (g — global)
  7. Optional Chaining (?) - This used in object in cases of condition and assiging the value. It is used for handling errors without writing big line of code.
  8. map - array method which return a array and iterate through the element of array.
  9. filter - array method which return filtered array.
  10. find - array method to find the index of specific element.
  11. includes - array and string method which is used to check element, string or char exist in the given input.
  12. reduce - array method to return a single value by doing operations in the array.

Top comments (2)

Collapse
 
zippcodder profile image
Deon Rich

Good concepts to cover for beginners, I would work on explaining with more clarity for people to better grasp them.

Collapse
 
kartikg09 profile image
Kartik

Hi @zippcodder
All the best for your great post. I hope will read it soon.
Thanks for the appreciation.