View code-quiz.txt
This file contains 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
#1: object | |
#2: 57 | |
#3: 10.5 | |
#4: undefined | |
#5: John | |
#6: 542 | |
#7: 113 | |
#8: 3 | |
#9: 64 | |
#10: 2 |
View javascript-exception-handler.js
This file contains 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
try { | |
var x = y / 10; | |
} catch(error) { | |
console.log(error); | |
} | |
// Console: ReferenceError: y is not defined |
View php-stop-object-serialization.php
This file contains 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
<?php | |
class Sun | |
{ | |
// ... | |
private function __sleep() {} | |
private function __wakeup() {} | |
}; |
View php-wakeup-sleep-methods.php
This file contains 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
<?php | |
class Room | |
{ | |
private $color = 'white'; | |
private $size = 'xl'; | |
public function setColor(string $color): void | |
{ | |
$this->color = $color; |
View js-global-variable.js
This file contains 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
window.name = 'شایان شایان پرور'; | |
function greeting() { | |
console.log('سلام آقای ' + window.name); | |
} | |
greeting(); // سلام آقای شایان شایان پرور | |
// ... |
View js-pass-by-value.js
This file contains 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
let name1 = "John"; | |
let name2 = name1; | |
console.log(name1); // John | |
console.log(name2); // John | |
name1 = "Paolo"; | |
console.log(name1); // Paolo | |
console.log(name2); // John |
View js-pass-by-reference.js
This file contains 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
let house1 = { | |
color: 'green' | |
} | |
let house2 = house1; | |
console.log(house1.color); // green | |
console.log(house2.color); // green | |
house1.color = "yellow" |
View typescript-enum.ts
This file contains 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
enum Colors {Red, Green, Blue}; | |
console.log(typeof Colors); // object | |
console.log(Colors); | |
/* | |
{ | |
'0': 'Red', | |
'1': 'Green', | |
'2': 'Blue', |
View javascript-hoisting.js
This file contains 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
// These two lines: | |
console.log(y); // undefined | |
y = "Street"; | |
// are interpreted as: | |
var y; | |
console.log(y); // undefined | |
y = "Street"; |
View javascript-push-object-into-local-storage.js
This file contains 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
let person = { | |
name: 'Bastian', | |
lastname: 'Schweinsteiger' | |
}; | |
person = JSON.stringify(person); | |
localStorage.setItem('user', person); | |
OlderNewer