login
I\'ve seen such href
s many times, but I don\'t know what exactly
javascript:
URLs aside; this is where void
can be used to write shorter code:
var error1 = false,
error2 = false,
error3 = false;
function error1() {
error1 = true;
}
function myFunction() {
// You can easily return and call a function at once, if you don't care about myFunction's return value
if (!someCondition1)
return error1();
// What if you want to set a value first?
if (!someCondition2) {
error2 = true;
return
}
// Shortest way to return and set a value at once
if (!someCondition3)
return void(error3 = true);
// More code goes here
}