Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Example of Logical AND assignment operator in es12

// In the example, the &&= will check if the filesCount is true.
// If true, then the right value will be assigned to the left variable.
let myFiles = {filesCount: 100, files:[]};
myFiles.filesCount &&= 5;
console.log(myFiles); // This will print: {filesCount: 5, files: Array(0)}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Example #Logical #AND #assignment #operator
ADD COMMENT
Topic
Name
6+1 =