1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Yuri [45]
3 years ago
14

Days of the week are represented as three-letter strings ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"). Write a javaScript f

unction solution that, given a string S representing the day of the week and an integer K (between 0 and 500), returns the day of the week that is K days later. For example, given S = "Wed" and K = 2, the function should return "Fri". Given S = "Sat" and K = 23, the function should return "Mon".
Computers and Technology
1 answer:
dmitriy555 [2]3 years ago
3 0

Answer:

function getDay(s, k){

var weekDays = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];

var index=weekDays.findIndex(function(weekDay){return weekDay==s;});

return weekDays[(index+k)%7];

}

Explanation:

//this functions receive the next parameters:

//s which is the day of the week

//k the number of days after s week day

function getDay(s, k){

var weekDays = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];

//variable index is the index in list weekDays of s

var index=weekDays.findIndex(function(weekDay){return weekDay==s;});

//use module operator % to get the remainder of the division (index+k)/7

//return the string value of the day

return weekDays[(index+k)%7];

}

You might be interested in
Programming in https<br>​
kakasveta [241]
What?? explain your question
3 0
2 years ago
What makes manually cleaning data challenging?
Alexxandr [17]

Manually cleaning data is done manually which makes it challenging. This make it prone to mistakes.

6 0
3 years ago
What is security in Technology<br>​
maria [59]

Answer:

IT security is a set of cyber security strategies that prevents unauthorized access to organizational assets such as computers, networks, and data.

3 0
3 years ago
Read 2 more answers
Whoever understands this first and replies will be the brainliest.<br><br><br><br> Road work ahead?
Scorpion4ik [409]

I SURE HOPE IT DOES (this is the best vibe if you dont get this you are an uncultured swine)

7 0
3 years ago
Read 2 more answers
Carlos, an algebra teacher, is creating a series of PowerPoint presentations to use during class lectures. After writing, format
yarga [219]

Answer:

see explanation

Explanation:

Carlos can make a copy of the old presentation that preserves all the formatting, and replace old content with new information.

5 0
3 years ago
Other questions:
  • Mark is learning to make logos. Once he finishes learning, he plans to freelance. Which software is most preferred to create art
    16·1 answer
  • Emily is an aspiring lyricist. She wants to make a demo tape to send to recording companies. Which input device can she use to r
    5·1 answer
  • (Analyze scores) Write a program that reads an unspecified number of scores and determines how many scores are above or equal to
    10·1 answer
  • Carlos own a hardware store.He currently is not using any software to track what he has in the store. .In one to two sentences,
    10·1 answer
  • It is always better to run over and give more information when you are giving a presentation versus quitting on time. true false
    15·2 answers
  • A ____ typically rests on the desk or other flat surface close to the user’s computer, and it is moved across the surface with
    13·1 answer
  • Compare and contrast the role that business users play when software is developed using Waterfall and Agile software development
    10·1 answer
  • To gain a competitive edge this year, the upper management of a global IT company has decided to focus on customer service, empl
    13·1 answer
  • Which Excel function or tool will you use to display the cells that are referred to by a formula in the selected cell
    8·1 answer
  • Your worksheet contains a price in cell A5 and many formulas refer to that price how would you refer to that price in the formul
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!