I was wondering how to write a method prefixed by .
as in .join()
[for arrays] such that for any [string-type] variable I had I could do
var myString.editAt(index)
without having to take the annoying and visually jarring editAt(myString,index)
.
In looking up answers to this (I don't know exactly how to phrase it which doesn't help me in my search) all I've found are what appear to be specific (?) ways to refer to objects - that is, ones with given variable names, and further that there are issues with the new
constructor, which I use as a fundamental part of many code.
I'm not totally sure if this means I want a method associated with a class or an object.
Could someone advise, bearing in mind that I may not have asked this with the right technical terms — more a question out of curiosity to learn than anything. Thanks.