Update: I recommend using an object style return. The array brackets are cute, but less useful. Positional args are fragile, and while this is only two, if you want to give a special error code or warning, then a simple new Error('asdf') can't represent either of these two (at least not very clearly).
So you may typically do:
return{error:newError('asdf')}
but you may occassionally:
return{warning:'Update skipped. Provided data is the same.',errorCode:'update_skipped',}
Note to self: I don't think I have any code that actually uses this idea. Was just a pure idea.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Update: I recommend using an object style return. The array brackets are cute, but less useful. Positional args are fragile, and while this is only two, if you want to give a special error code or warning, then a simple
new Error('asdf')can't represent either of these two (at least not very clearly).So you may typically do:
but you may occassionally:
Note to self: I don't think I have any code that actually uses this idea. Was just a pure idea.