D.r.y


#1

I have no idea what i'm supposed to write for number 6 in java script DRY


#2

Can you place the link of the exercise?


#3

https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/1/1?curriculum_id=506324b3a7dffd00020bf661#


#4

i don't get what i'm supposed to do


#5

The exercise is clear. The instructions are to:

Declare a function of how much oranges cost.

var orangeCost = function(dollar) {

}

Then, log the cost of the 5 oranges.

var orangeCost = function(dollar) {
console.log(dollar * 5);
}

Then, set the cost of an orange to 5 dollars.

var orangeCost = function(dollar) {
console.log(dollar * 5);
}
orangeCost(5);

#6

so what is the code supposed to look like


#7

hey @nelsona0

Read above ^ as explained by zolated, try and apply it in your lesson if you fail then show us your code and we can guide you. :slight_smile:


#8

did that it worked im still confused about it though even if im past it on a new lesson


#9

Which part you don't understand ?


#10

Why the code below does not work?

var orangeCost = function (price)
{
var cost = price*5;
console.log("The price of five oranges is" + " "+ cost);
};

orangeCost(5);


#11

It doesn't work in the lesson as the lesson asks you to do it in a different way so the SCT doesn't pass it.


#12