Questions tagged as 'undefined'

3
answers

How to check if a variable is defined?

I tried to do it this way: else if (vCodUG === undefined) and gave error of:    Uncaught ReferenceError: vCodUG is not defined     
asked by 05.06.2014 / 16:24
3
answers

How to verify undefined correctly in Javascript

What is the best way to check if an element / variable is undefined in Javascript? I have already seen some examples using variavel === undefined and others using typeof variavel == "undefined" .     
asked by 04.08.2015 / 23:26
4
answers

Avoiding the error "Can not read property 'c' of undefined"

Considering the following code: var a = {}; if (a.b.c !== undefined) { console.log("definido!"); } else { console.log("indefinido!"); } Is there any way to check each property without having to test one by one? What I...
asked by 20.02.2017 / 19:20
3
answers

function $ .Ajax () return value?

this is the code: var res = VerFileRepetidoBancoAjax( "teste" ); console.log("res="+res); function VerFileRepetidoBancoAjax( str ){ $.ajax({ url: "caminho.", type: "get", dataType:"json", data: "dado="+ str, async:...
asked by 18.08.2014 / 17:05
4
answers

Another option to use @ in PHP?

I do not feel very comfortable having to use @ before some variables and sessions when I make conditions, to avoid Unexpected Index error that happens when the variable or session was not initialized previously. I wanted to know...
asked by 12.05.2015 / 16:29
1
answer

AngularJS - page can not find the controller

I'm starting to test applications using AngularJs and Spring Boot. My problem is this: All scripts are normally imported into the browser, but IF I put the tag "ng-controller=" HeadController "" in any tag on my page, I have an error saying t...
asked by 14.03.2016 / 03:11
2
answers

Variable undefined

If I put the variable contador out of function , the return on alert is undefined . But if I put it inside function , it returns the correct value but does not increase. What am I doing wrong? var qtdeCampos = 0; var c...
asked by 31.03.2016 / 23:00
1
answer

Why does "undefined" occur even when defining the exact element to be reached?

I'm applying a injection in the address bar of the web browser , on the page of a video on youtube, in which I want to extract the date of the posting of the same. If we open this link we see a div similar to this: Whenweselectt...
asked by 25.02.2017 / 17:21
3
answers

JavaScript function returning Undefined

I'm having a problem with a JavaScript function. I need to check the existence of an item in the database and so I use a js function with ajax called verificaExistente . The php returns me a Json and in this function I check if there are e...
asked by 12.03.2015 / 13:43
2
answers

variable undefined

Hello, I'm having a problem retrieving the global variable total in a script. In an alert inserted in the same scope it is displayed normal, but in a statement it is not returned, undefined appears. follows the excerpt: preco =...
asked by 27.10.2015 / 15:41