0

I am returning to Javascript development after many years of not doing it. I am running visual studio code on a mac. I am having trouble understanding the tool tip documentation provided for me in visual studio code.

Could some one please clarify?

Example 1:

const numbers = [1,5,3,8];
let val;
val = numbers.sort(

When I am hoovering over the sort function I get this: enter image description here

As far as I can tell this tells me that:

  • (method) -> This is a method
  • Array -> This is an array
  • -> The types in the array are numbers?
  • sort -> The name of the method
  • compareFn?: (a: number, b: number) -> The input parameter is a function(a,b)
  • => number -> The return type must be a number? (Not sure about the =>)
  • number[] -> The method returns an array

Is this correct?

Example 2:

const numbers = [1,5,3,8];
let val;
val = numbers.find(

Tool tip: enter image description here

I am not sure what this means. To be clear, looking at this reference I understand how to use the find method but I don't understand the documentation. Also the reference displays the syntax as this:

arr.find(callback[, thisArg])
user1329339
  • 1,295
  • 1
  • 11
  • 26

0 Answers0