Answers for "if and else shorthand"

0

if and else shorthand

//Long version  
let points = 70;   
let result;   
if(marks >= 50){  
    result = 'Pass';   
}else{  
    result = 'Fail';   
}

//Shorthand  
let points = 70;   
let result = marks >= 50 ? 'Pass' : 'Fail';
Posted by: Guest on April-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language