[SOLVED] why typescript typing syntax error for filter function

Issue

example is pretty basic but I still can’t find the right syntax :

  let array = [1, 2, 3];
  array.filter(
  n: number => true
)

error message is : "cannot find name n"

Solution

This is the right syntax:

let array = [1, 2, 3];

array.filter(
  (n: number) => true
)

Answered By – CKE

Answer Checked By – Willingham (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *