This is my code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<p>
<script>
document.write(smsCount) // i want to get "1"
</script>
</p>
</body>
</html>
My script.js:
function sameer() {
console.log('function working');
var smsCount = 1;
}
sameer();
How to access variable which is located in my function name sameer.
window.smsCount = 1;