- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What happens if we re-declare a variable in JavaScript?
On re-declaring a variable in JavaScript, the variable value still remains the same.
Example
Let’s see an example. Here, we are declaring the variable age −
<html> <body> <script> <!-- var age = 20; var age; if( age > 18 ){ document.write("Qualifies for driving"); } //--> </script> </body> </html>
- Related Articles
- What happens when you do not declare a variable in JavaScript?
- How do we declare variable in Python?
- Can re-declaring a variable destroy the value of that variable in JavaScript?
- Can we declare a static variable within a method in java?
- Can we re-throw errors in JavaScript? Explain.
- What happens when you declare a method/constructor final in Java?
- What happens if we grow kharif crops in winter?
- How to declare a variable in MySQL?
- How to declare a variable in C++?
- How to declare a variable in Python?
- What is overloading? What happens if we overload a main method in java?
- What happens if we try to extend a final class in java?
- What happens if we define a concrete method in an interface in java?
- How to declare a global variable in C++
- How to declare a local variable in Java?

Advertisements