Skip to content

Instantly share code, notes, and snippets.

@amypellegrini
Created November 14, 2016 19:19
Show Gist options
  • Select an option

  • Save amypellegrini/5f9823cdc92861bc0632b34cecb85a5d to your computer and use it in GitHub Desktop.

Select an option

Save amypellegrini/5f9823cdc92861bc0632b34cecb85a5d to your computer and use it in GitHub Desktop.

Revisions

  1. amypellegrini created this gist Nov 14, 2016.
    7 changes: 7 additions & 0 deletions findShort.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    // Shortest Word

    function findShort(str) {
    return str.split(' ').sort((a, b) => {
    return a.length < b.length ? -1 : 1;
    })[0].length;
    }