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
DeShawn uses Google Ads. He wants to enable website call conversion tracking so he can see how his current ad campaign is drivin
eimsori [14]

Answer:

A dynamically created Google forwarding number

Explanation:

A temporary number that is used to forward the call that are  assigned to a Google Ads call extension is called Google forwarding number. This number is used to forwards calls to the advertiser's phone number for the purpose of tracking call conversions.

These number are created dynamically to trace the advertisers conversation.

5 0
3 years ago
A system engineer enhances the security of a network by adding firewalls to both the external network and the internal company n
Tema [17]

Answer:

Vendor diversity

Explanation:

Different cybersecurity companies maintain different codebases, which means an exploit that might poke holes in the security of one likely won't breach the other. In this situation, the network would still have an active and effective firewall from one vendor even as the exploit from the other vendor's firewall is being patched.

8 0
2 years ago
What were precomputed tables and why were they necessary?​
Alex Ar [27]

Answer:

In algorithms, precomputation is the act of performing an initial computation before run time to generate a lookup table that can be used by an algorithm to avoid repeated computation each time it is executed.

7 0
3 years ago
Read 2 more answers
!!!!!16 POINTS!!!!Can a computer evaluate an expression to something between true and false? Can you write an expression to deal
levacccp [35]

Answer:

Yes a computer can evaluate between a true or false. x < 1, and if the condition is met, the value is true, else its false. A computer itself cannot handle any "maybe" expression, but with the influence of human opinion, in theory its possible. Chocolate cake < Vanilla cake, is an example. Entirely on opinion.

4 0
3 years ago
Give the value of the zero flag, the carry flag, the signflag, and the overflow flag after each of the following instructions if
Vanyuwa [196]
The correct answer is A for this question
6 0
2 years ago
Other questions:
  • There are N bulbs numbered from 1 to N, arranged in a row. The first bulb is plugged into the power socket and each successive b
    6·1 answer
  • 1.Which type of camera tool pushes the picture back and makes it wider, exaggerating the distance between the background and for
    13·2 answers
  • Computer Architecture
    7·1 answer
  • Tower Building Activity
    12·1 answer
  • Prewritten, commercially available sets of software programs that eliminate the need for a firm to write its own software progra
    7·1 answer
  • The road is closed a head
    9·1 answer
  • Which of the following is one of the tools in REPL.it that helps prevent syntax errors?
    10·1 answer
  • 1. What type of malware is triggered by a specific condition, such as a specific date or a particular user account being disable
    6·1 answer
  • How are comments in a Java program treated by the compiler?
    14·2 answers
  • Released in 1976, the Apple I was Apple Computer's first product.<br><br> O True<br> O False
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!