Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript arrow function 
Javascript :: clear a div 
Javascript :: how to check checkbox using jquery 
Javascript :: create node server 
Javascript :: npm react dropdown 
Javascript :: javascript string ends with 
Javascript :: callback hell javascript 
Javascript :: js jquery include external script 
Javascript :: javascript combine two index elements 
Javascript :: javascript check if string contains a text substring 
Javascript :: alert, react native alert 
Javascript :: how to check request method was a get 
Javascript :: spining load react component 
Javascript :: react native build android 
Javascript :: react map gl 
Javascript :: return all class innerhtml in javascript 
Javascript :: setting usestate to prop 
Javascript :: react declare multiple states 
Javascript :: convert date dd/mm/yyyy to date object js 
Javascript :: rotate array by d elements javascript 
Javascript :: regex for a, e, i , o , u 
Javascript :: compare two array in javascript 
Javascript :: how to write a json in r 
Javascript :: nodejs express server img src 
Javascript :: typescript/JavaScript time ago from datetime 
Javascript :: momentjs 
Javascript :: lodash sort json 
Javascript :: javascript fetch get data from promise 
Javascript :: delete element html javascript 
Javascript :: javascript factorial of a number 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =