why are substrings , methods in javascript?

so my question is : why is substring a method while it performs on strings
which are not objects in javascript like the code I have here.

const S = `hello world`;
console.log(S.substring(0,2))

Source: Ask Javascript Questions

LEAVE A COMMENT