so I wrote this for my first computer science class assignment. However, the page returns that if input is gpa(A)
, the results is 3
. It's like only the first conditionals if
is running. I switched around the A
, B
,C
and 2
, 3
, 4
but it's always the first if
no matter what the gpa(r)
is. How does this happen?
var gpa = function(r) {
if (r = "B"){
return 3;
}
if (r = "C"){
return 2;
}
if (r = "A"){
return 4;
}
}