Skip to content

Instantly share code, notes, and snippets.

@abhinavnigam2207
Created February 27, 2021 20:37
Show Gist options
  • Save abhinavnigam2207/ee83d8eaa98a4da4bfef0dabee0120a8 to your computer and use it in GitHub Desktop.
Save abhinavnigam2207/ee83d8eaa98a4da4bfef0dabee0120a8 to your computer and use it in GitHub Desktop.
/* ******************** If Else ********************* */
const integer =7;
let resp = '';
if (integer >= 10) {
resp = '2 digit integer';
} else {
resp = '1 digit integer';
}
/* ******************** Ternary ******************** */
const integer =7;
const resp = (integer >= 10) ? '2 digit integer': '1 digit integer';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment