Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get variable value outside function in javascript

/* Not putting "var", "let" or "const" will make the variable Public
And usable outside a functin */

function Play(){
  	Video = 12 // Seconds
	var Length = 15
}
console.log(Video) // Prints 12
console.log(Length) // "Lenght" is undefined
 
PREVIOUS NEXT
Tagged: #variable #function #javascript
ADD COMMENT
Topic
Name
2+2 =