Difference between revisions of "Bugs and mistakes"
From Wiki2
| (One intermediate revision by the same user not shown) | |||
| Line 3: | Line 3: | ||
for sorting | for sorting | ||
<pre> | <pre> | ||
const conres = | |||
{ variety: 'Glacier', dot: 'yellow', num: 0 }, | { variety: 'Glacier', dot: 'yellow', num: 0 }, | ||
{ variety: 'Supersweet 100', dot: 'blue', num: 0 }, | { variety: 'Supersweet 100', dot: 'blue', num: 0 }, | ||
| Line 12: | Line 13: | ||
{ variety: 'Glacier', dot: 'yellow', num: '4' }, | { variety: 'Glacier', dot: 'yellow', num: '4' }, | ||
{ variety: 'Supersweet 100', dot: 'blue', num: '4' }, | { variety: 'Supersweet 100', dot: 'blue', num: '4' }, | ||
const sorres =conres.sort((a,b)=>a.variety < b.variety ? -1 :1) | |||
NOT | |||
</pre> | </pre> | ||
<s>const sorres =conres.sort((a,b)=>a.variety < b.variety)</s> | |||
Latest revision as of 12:59, 2 April 2019
bugs and mistakes I always make
for sorting
const conres =
{ variety: 'Glacier', dot: 'yellow', num: 0 },
{ variety: 'Supersweet 100', dot: 'blue', num: 0 },
{ variety: 'Brandywine', dot: 'red', num: '5' },
{ variety: 'Purple Cherokee', dot: 'purple', num: '7' },
{ variety: 'Moskovich', dot: 'green', num: '4' },
{ variety: 'Valencia', dot: 'orange', num: '4' },
{ variety: 'Striped German', dot: 'pink', num: '4' },
{ variety: 'Glacier', dot: 'yellow', num: '4' },
{ variety: 'Supersweet 100', dot: 'blue', num: '4' },
const sorres =conres.sort((a,b)=>a.variety < b.variety ? -1 :1)
NOT
const sorres =conres.sort((a,b)=>a.variety < b.variety)