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
| if (isEnabled) { | |
| return “enabled”; | |
| } else { | |
| return “not enabled”; | |
| } | |
| return isEnabled ? “enabled” : “not enabled”; |
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 exampleFunction: boolean = function(x: string): boolean { | |
| return x; | |
| } |
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
| // we are prepending “private” variables with an underscore _ | |
| var MyExampleModule = function() { | |
| var _privateVar = “Hello”; | |
| return { | |
| getPrivateVar: function() { | |
| return _privateVar; | |
| }, | |
| setPrivateVar: function(value) { |
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 hoistedFunctionExample() { | |
| console.log(“hello world!”); | |
| } |
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 z = 5; | |
| function outer() { | |
| var x = 0; | |
| console.log(y, x, z); | |
| // logs “undefined, 0, 5”. I am not within the same closure as y, but I am with x, z | |
| function inner() { | |
| var y = 1; | |
| console.log(x, y, z), // logs “0, 1, 5”. I am in the closure with x, y, and z. | |
| } |
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 sum(x) { | |
| return function(y) { | |
| return x + y; | |
| }; | |
| }; |
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
| <div class=”container”> | |
| <div class=”row”> | |
| <div class=”col-md-6”>Hello</div> | |
| <div class=”col-md-6”>World</div> | |
| </div> | |
| </div> |
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
| int sum = Arrays.stream(new int[]{1, 2, 3}) | |
| .filter(i -> i >= 2) | |
| .map(i -> i * 3) | |
| .sum(); |
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
| Thread thread = new Thread(new Runnable() { | |
| public void run() { | |
| System.out.println("Sample Expression"); | |
| } | |
| }); |
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
| public interface Vehicle { | |
| public void move(); | |
| default void hoot() { | |
| System.out.println("Sample"); | |
| } | |
| } |
NewerOlder