This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function calcDate(date1, date2){ | |
| /* | |
| * calcDate() : Calculates the difference between two dates | |
| * @date1 : "First Date in the format MM-DD-YYYY" | |
| * @date2 : "Second Date in the format MM-DD-YYYY" | |
| * return : Array | |
| */ | |
| //new date instance | |
| const dt_date1 = new Date(date1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function calcDate(date1, date2){ | |
| /* | |
| * calcDate() : Calculates the difference between two dates | |
| * @date1 : "First Date in the format MM-DD-YYYY" | |
| * @date2 : "Second Date in the format MM-DD-YYYY" | |
| * return : Array | |
| */ | |
| //new date instance | |
| const dt_date1 = new Date(date1); | |
| const dt_date2 = new Date(date2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Call the function | |
| calcDate("11-19-2021", "12-12-2026"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (condition_to_check) ? (action_to_execute_if_condition_is_true) : (action_to_execute_if_condition_is_false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 20; | |
| ( x == 20 ) ? (console.log("x is 20")) : (console.log("x is not 20")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 20; | |
| ( x == 0 ) ? (console.log("x is 0")) : | |
| ( x == 10 ) ? (console.log("x is 10")) : | |
| ( x == 20 ) ? (console.log("x is 20")) : | |
| (console.log("x is unknown")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 20; | |
| if( x == 0 ) { | |
| (console.log("x is 0")); | |
| }else if( x == 10 ) { | |
| (console.log("x is 10")); | |
| }else if( x == 20 ) { | |
| (console.log("x is 20")); | |
| }else { | |
| (console.log("x is unknown")) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 0; var y = 0; var z = 0; | |
| (!x && !y && !z) ? ( | |
| console.log('reassigning the variables'), | |
| x = 10, | |
| y = 10, | |
| z = 10, | |
| console.log("x is now "+x), | |
| console.log("y is now "+y), | |
| console.log("z is now "+z), | |
| console.log('variables have been reassigned') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $a = null; $b = null; $c = null; | |
| (!$a && !$b && !$c) ? | |
| ( | |
| ($a = 1). | |
| ($b = 2). | |
| ($c = 3). | |
| (print("A, B, C = ".$a.' '.$b.' '.$c)) | |
| ) | |
| : (print("A, B AND C are not empty!")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $f = 0; | |
| ($f == 0) ? | |
| echo("f is 0") | |
| : echo("f is not 0") |