Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Given a non-negative integer, 3 for example, return a string with a murmur: "1 sheep...2 sheep...3 sheep...". Input will always be valid, i.e. no negative integers.
- var countSheep = function (num){
- count= "";
- for(var i = 1; i <= num; i++){
- count += i + " sheep, ";
- }
- return count;
- }
- countSheep(8);
- //do loop starting with one and count to max of input number
Add Comment
Please, Sign In to add comment