Instructions: You are going to implement three functions. At the bottom of this code the functions are all being used. Your job is to write their definitions. If the functions work as expected, you won't see any red in your console. If they don't... well, red is bad.
There's a function returnANumber()
being called. It should prompt
for a number, which will be a string (right?!). However, returnANumber()
should return a number.
returnANumber();
There's a function addTwoNumbers()
being called. It will be called
with two arguments. Your job is to make it add the two arguments together. It
should also work if you pass in two numbers as strings (e.g. "2" + "2" = 4).
addTwoNumbers(5, 6); // should return 11
addTwoNumbers("5", "6"); // should also return 11
There's a function createImage()
. It should return an <img>
element. It will be called with three arguments, a source, width, and height. All those
attributes should be set on the image.
createElement("http://example.com/image.jpg", 450, 300);
// should return <img src="http://example.com/image.jpg" width="450" height="300">
createElement("http://example.com/image.jpg", 45, 30);
// should return <img src="http://example.com/image.jpg" width="45" height="30">