Created
June 30, 2017 13:11
-
-
Save Jonathancollinet/bfc4a85a6776a8f1690f596ed613125f to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script src="index.js"></script> | |
</body> | |
</html> |
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
// valeurs primitives | |
// string | |
// boolean | |
// numbers | |
// valeurs non primitives | |
// Array | |
// Object | |
// Function | |
function editVariable(param) { | |
param = 54; | |
} | |
let str = "salut", | |
nb = 34, | |
bool = false | |
editVariable(str) | |
console.log(str) | |
editVariable(nb) | |
console.log(nb) | |
editVariable(bool) | |
console.log(bool) | |
function editObj(obj) { | |
obj.value = 54; | |
} | |
function editArr(arr) { | |
arr[0] = 54; | |
} | |
let obj = {value: "salut"}, | |
arr = ["toto"] | |
editObj(obj) | |
console.log(obj) | |
editArr(arr) | |
console.log(arr) | |
const obj = 0xFA45BC4FE3D8; // ->>> {value: 'toto'} | |
myFunction(obj) // 0xFA45BC4FE3D8 | |
function myFunction(param) { | |
// param -> 0xFA45BC4FE3D8 | |
param.value = 54; | |
obj.value = "salut!!"; | |
console.log(param.value) | |
} | |
let str = "salut"; // ->>> "salut" | |
myFunction(str) // "salut" | |
console.log(str) | |
function myFunction(param) { | |
// param ->> "salut" | |
param = 54; | |
str = "toto" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment