From b82280f78b9258b32de0cd20da989a5ffdbba4c5 Mon Sep 17 00:00:00 2001 From: Ekron-Shoo <67784844+Ekron-Shoo@users.noreply.github.com> Date: Sat, 6 Nov 2021 23:39:44 +0530 Subject: [PATCH] Gallery- Javascript-DiceRoll Using Javascipt with Github Co-Pilot to write a function for rolling a dice and returning a random number between 1 and 6. --- .../javascript-DiceRoll-rolls_a_dice/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gallery/javascript-DiceRoll-rolls_a_dice/README.md diff --git a/gallery/javascript-DiceRoll-rolls_a_dice/README.md b/gallery/javascript-DiceRoll-rolls_a_dice/README.md new file mode 100644 index 0000000..7573dee --- /dev/null +++ b/gallery/javascript-DiceRoll-rolls_a_dice/README.md @@ -0,0 +1,15 @@ +# Using JS along with Co-Pilot to write a Dice Roll Function + +A mere comment saying- `//this function rolls a dice` makes co-pilot understand what we want and it writes the code for us. + +The code- + + //this function rolls a dice + + function rollDice() { + return Math.floor(Math.random() * 6) + 1; + } + +For the live video open https://user-images.githubusercontent.com/67784844/140619338-33778342-9b5b-4480-a0ff-d1b1d3eb7ae1.mp4 + +