3 ms·
No problem. I think the suggestion below, about using empty lines, might be a good approach to pursue. One additional thing to consider about the trailing-white
by jscheel 14y ago
No problem. I think the suggestion below, about using empty lines, might be a good approach to pursue. One additional thing to consider about the trailing-whitespace, a lot of (sometimes anal) developers have set up hooks to automatically strip whitespace at the end of a file every time they hit save. To clarify the array, in your suggestion, the favorite_colors would come out as a string, that I would then eval or parse, correct?
- breck 14y ago> One additional thing to consider about the trailing-whitespace, a lot of (sometimes anal) developers have set up hooks to automatically strip whitespace at the end of a file every time they hit save. Strip whitespace at the end of all lines, or at the end of a file? Wouldn't be a problem at the end of files, but at the end of lines might be an issue. > To clarify the array, in your suggestion, the favorite_colors would come out as a string, that I would then eval or parse, correct? Correct. A leaf/value can use any encoding. So you could have something like this: function Person (note) { this.patch(note) if (this.favorite_colors) this.favorite_colors = JSON.parse(this.favorite_colors) } Person.prototype = new Note() var joe = new Person('favorite_colors ["blue", "red", "green"]') console.log(joe.favorite_colors[0]) // prints "blue" console.log(joe.favorite_colors[2]) // prints "green"