6. Don't Repeat Yourself


#1



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

The code that i have returns and it is correct but when i use the code it prints "NaN" instead of 25, can anyone tell me why this is ? (Please bear in mind i am not very good at coding so if you give an explanation please keep it simple :D)


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


#2

My code :slight_smile:

var orangeCost = function(cost){
        sum = cost * 5;
        console.log(sum);
    }
orangeCost(2);

Dont give your function a string if it needs a integer.