JavaScript mendapatkan nilai fungsi luar

/*
Scope is important in JavaScript (and many programming
languages). If a variable is declared within a local
scope, it can only be accessed from within that local
scope.
*/
function localScope() {
	// this variable is declared locally, it can only
	// be accessed from within this function
	let localVariable = "something";
}
// if you were to try to access localVariable out here
console.log(localVariable); // ReferenceError: 'localVariable' is undefined
// you would not be accessing the variable you declared inside the function

// to get a specific value from a function, you can use
// the return keyword to return a specific value
function add(x, y) {
	return x + y;
}
const two = add(1, 1);
MattDESTROYER