console.log passed function argument

JavaScript, ES6

ES6 TIP: console.log passed value, when using implicit arrow function return

Explanation

  • console.log(frm) || frm.stars > 100000: This logs the frm object and then evaluates the condition frm.stars > 100000.

Usage

To log the passed function argument and filter the array, use the following code:

const frameworks = [
  {
    name: 'Angular',
    stars: 39000,
  },
  {
    name: 'React',
    stars: 107000,
  },
  {
    name: 'Vue',
    stars: 109000,
  },
];

const over100k = frameworks.filter(
  (frm) => console.log(frm) || frm.stars > 100000
);