petrovicstefanrs / 30_seconds_of_knowledge

Google Chrome Extension that lets you gain new developer skills, every time you open a New Tab.
https://30secondsofknowledge.com/
MIT License
942 stars 121 forks source link

Update head(.md) to check on empty or null array #78

Closed cmelgarejo closed 4 years ago

cmelgarejo commented 4 years ago

Update head to check on empty, undefined, null array. So you you can guard against

head();
head([]);
head(null);
head(undefined);
if (head(arr) === undefined) { 
// do nothing, or something else
}
petrovicstefanrs commented 4 years ago

@cmelgarejo Sorry but you'll need to make this PR on the @30-seconds/code repo. The snippets in this repo are just a collection of snippets from other 30seconds repos.