Tuesday 20 August 2013

Importance of giving an initial value to the variables "Local or global " javascript

Importance of giving an initial value to the variables "Local or global "
javascript

I am wondering what is the importance of having an initial value for a
variable in JavaScript.
function data() {
var self = this;
self.formatLength;
}
function data() {
var self = this;
self.formatLength = null;
}
What if you do not give an initial value such as null or whatever value to
that variable then operate on it .
would it make a difference? Since I am new in JavaScript and trying to
keep good habits and I was wondering about it.

No comments:

Post a Comment