gandjelar
gandjelar gandjelar
  • 12-07-2022
  • Computers and Technology
contestada

For given natural number n, e.g n=3, print string "1 sheep...2 sheep...3 sheep". Can someone help?​

Respuesta :

jayilych4real
jayilych4real jayilych4real
  • 18-07-2022

The code that is used to count sheep aloud in Javascript is given as:

var countSheep = function (num){

 //start with a counter i = 1

 // increment i

 // stop until i == num

 // "interpolation" to insert variables

 // return joint array

   let smallArr = "";

   for (let x = 1; x <= num; x++)

   {

      smallArr += `${x} sheep...`

   }

   return smallArr;

};

Read more about javascript here:

https://brainly.com/question/16698901

#SPJ1

Answer Link

Otras preguntas

Ms groves had trays of paint each tray has five colors one of the colors is purple.what fraction of the colors in 20 trays is purple
Explain how you know that 7/12 is greater than 1/3 but less than 2/3?
If there are 112 students for 14teachers, what is the fraction and the unit rate?
If there are 112 students for 14teachers, what is the fraction and the unit rate?
What is   a quarter past 5 mean
The message of the DNA Code is information for building_______.
8x+15=3x-20 how do you do this
Use the form y=mx +b for linear equations.Write the equation for the following relation.C = {(x, y): (6, 15), (8, 21), (10, 27), . . .}
The main goal of the Jesuits was to?
How did geographic features influence the Louisiana purchase and the monroe doctrine?