3 ms·
Forgive me for this simple and unrelated question, but I'm new to JS development. This line right here, what is this? let courseId = fields.to.substring(0, fie
by kwxza 7y ago
Forgive me for this simple and unrelated question, but I'm new to JS development.
This line right here, what is this?
let courseId = fields.to.substring(0, fields.to.indexOf('@'));
I've never seen this 'to' string method and I can't find a doc page for it. Can you explain it or point me towards a reference? Thanks
- stevula 7y agoI haven't read the article, but there's no special significant to the `to` here. It is just looking up the value of a key named `to` in an object called `fields`, using [dot notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...): const fields = { to: "foo@bar.com" }; fields.to // "foo@bar.com