Question: JavaScript 1) The function hill is implemented as follows: function hill(x) { return -2 * (x - 4) * (x - 16); } Write a
JavaScript
1) The function "hill" is implemented as follows:
function hill(x) { return -2 * (x - 4) * (x - 16); }
Write a function called quadratic that takes a constant factor and two roots and returns an anonymous function that computes that curve. In other words, quadratic(-2,4,16) should return an anonymous function that behaves the same as hill.
2) The function wrapString(inString, tag) is implemented as follows, so wrapString('foo','em') would return"foo"`:
function wrapString(inString, tag){ return "<" + tag + ">"+ inString + "">"; }
Write a function called makeWrapper(tag) that returns a one-argument anonymous function that wraps a string with the given tag.
Write a function called wrapStrings that takes an array of strings and a tag (a string), and returns an array of strings where each is wrapped with the given tag. Use the map() method and the makeWrapper function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
