Questions tagged as 'javascript'

3
answers

How to implement google reCAPTCHA on my site?

I'm trying to implement the reCAPTCHA of Google on my site, and I can not do the integration Server-Side (I use the PHP language). How can I make reCAPTCHA work, and do the validation before submitting my form data?...
asked by 24.04.2015 / 16:19
8
answers

Is using validation via client sufficient?

Is using validations in JavaScript enough for efficient validation? Example : Validate dates. Is it also necessary to check the code? What are the disadvantages of doing validations via client-side ?
asked by 17.04.2014 / 18:59
2
answers

Do I really need to put "text / javascript" in the script tag?

We are in 2016. I have read in some places on the internet that it is no longer necessary to use this type="text/javascript" statement. In fact, using the script tag without declaring this snippet does not affect Javascript's worki...
asked by 29.11.2016 / 11:42
5
answers

Why NaN ^ NaN == 0?

Look at these tests I made on the browser console: NaN / NaN NaN NaN * NaN NaN typeof NaN "number" NaN ** NaN NaN NaN ^ NaN 0 Why exactly does this happen?     
asked by 08.06.2017 / 13:13
4
answers

What is the correct way to do a regular replacement in JavaScript for all occurrences found?

What is the correct way to do a regular replacement in JavaScript for all occurrences found? The way I currently do: var i = 0; while ((i = str.indexOf("_", i)) != -1) { str = str.replace("_", " "); } Or until: str = str.split("_")...
asked by 12.12.2013 / 12:20
5
answers

Why is multiplication faster than division?

Bit brushing question, but I was reading an article on javascript that says split is slower than doing multiplication. And for example, I would recommend changing the code below: var resultado = 4/2; by that would be faster. var result...
asked by 28.03.2014 / 13:38
6
answers

How to put default arguments (default) in a JavaScript function?

In R this would be very simple: funcao <- function(x=10) return(x) If you call funcao() without arguments, the result will be 10 . How to do the same in JavaScript? And how do I know if there are default values in...
asked by 09.05.2014 / 17:28
5
answers

How to calculate the age of a person with JS, from the date of birth?

How can I calculate the age of a person in Javascript from the date of birth? I tried something like: function idade(dia, mes, ano) { return new Date().getFullYear() - ano; } idade(11, 12, 1980); // 33 idade(15, 2, 2011); // 2 idade(5...
asked by 11.02.2014 / 07:11
5
answers

What is Vanilla JS?

I have already found this term in several places, "Vanilla JS". It seems to be cited as a framework , but in the codes where it is quoted and on the site itself the code presented is pure JavaScript.     
asked by 15.01.2015 / 13:00
4
answers

Upload file with AJAX

I would like to know if there is any simple way to upload files via AJAX + JSON. If there is one, what would it be?     
asked by 18.03.2014 / 18:55