From e0187dc551073fdd49053fe1b5fc3c05afaa99a7 Mon Sep 17 00:00:00 2001 From: volkfm98 Date: Tue, 10 Jul 2018 06:07:13 +0500 Subject: [PATCH] Add func getting memes array and returning random meme string --- src/getRandomMeme.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/getRandomMeme.js diff --git a/src/getRandomMeme.js b/src/getRandomMeme.js new file mode 100644 index 0000000..ec3d276 --- /dev/null +++ b/src/getRandomMeme.js @@ -0,0 +1,11 @@ +var getRandomMeme = function(memes) { + if (memes === undefined) { + var memes = [ + "Place", + "Your memes", + "Here" + ]; + } + + return memes[Math.floor(Math.random() * memes.length)]; +}