Skip to content

Latest commit

 

History

History
68 lines (56 loc) · 828 Bytes

File metadata and controls

68 lines (56 loc) · 828 Bytes
description Condition
keywords js, condition
title JavaScript condition
toc_max 4

condition

  • if
  • else
  • else if
  • tenary condition

if

if (condition_here){
  //statement
}

else

if (condition_here){
  //statement
}else{
  // statement
}

else if

if (condition_here){
  //statement
}else if (condition_here) {
  // statement
}else if (condition_here) {
  // statement
}else if (condition_here) {
  // statement
}else {
  // statement
}

tenary condition

  • condition ? trueValue : falseValue

switch

  let product = 'and';
  switch(product) {
    case 'web':
      console.log('web product');
      break;
    case 'android':
    case 'and':
      console.log('android development');
      break;
    default:
      console.log('I am default');
  }