single if statement js true false
//ternary operator syntax and usage:
condition ? doThisIfTrue : doThisIfFalse
//Simple example:
let num1 = 1;
let num2 = 2;
num1 < num2 ? console.log("True") : console.log("False");
// => "True"
//Reverse it with greater than ( > ):
num1 > num2 ? console.log("True") : console.log("False");
// => "False"condition ? doThisIfTrue : doThisIfFalse
1 > 2 ? console.log(true) : console.log(false)
// returns falsecondition ? exprIfTrue : exprIfFalse
Also in JavaScript:
- create react native app npx
- set navigation drawer to open by default react native
- js loop through associative array
- JavaScript append text to div
- download datepicker js
- algolia react hits
- make indexOF in js
- how to update node modules
- how to send data using ajax
- props and state react
- data table in angular 8 from api
- jquery selector checked
- javascript check if object is null or empty
- js loop over array of objects extract value
- upload bloob javascript
- js date enlever jour
- display array in div javascript
- p5.js put canvas in specific place
- v-btn click
- XJavascript:$.ge
- select a form by name jquery
- sort array by string length javascript
- javascript filter and order
- jquery remove br from div