I have a code like this..
I'm stuck in this field:
Because even if the [ic]x[/ic] didn't exist it might run to the 'true' statement, because it might check for the argument's value.
So I might like to get it to work so it might search for variables / functions that exist inside the DOM. I've tried using [ic]window.hasOwnProperty[/ic] but I can't get it to work. :/
Help?
- Code:
function foo(x) {
if(x) {
console.log(x);
}else{
x = "Data didn't entered";
console.log(x);
}
if(x) {
console.log('Available data!');
console.log(x);
}else{
console.log('Unavailable data.');
x = 'foo';
console.log(x);
}
}
I'm stuck in this field:
- Code:
if(x) {
console.log('Available data!');
console.log(x);
}
Because even if the [ic]x[/ic] didn't exist it might run to the 'true' statement, because it might check for the argument's value.
So I might like to get it to work so it might search for variables / functions that exist inside the DOM. I've tried using [ic]window.hasOwnProperty[/ic] but I can't get it to work. :/
Help?