+ 4

What does return without any value mean in javascript?

I always see a code like this but don't what the return statement is doing from here function checkFileSize() { var FS = document.getElementById("FS"); var files = FS.files; // If there is (at least) one file selected if (files.length > 0) { if (files[0].size > 75 * 1024) { // Check the constraint FS.setCustomValidity("The selected file must not be larger than 75 kB"); return; } } // No custom constraint violation FS.setCustomValidity(""); }

21st Nov 2019, 9:55 AM
Hafsa Mohamed
Hafsa Mohamed - avatar
5 Answers
+ 4
means quiting the function
21st Nov 2019, 10:10 AM
Gordon
Gordon - avatar
+ 7
Only returns the program flow/counter to the point just after function invocation.
21st Nov 2019, 11:35 AM
Sonic
Sonic - avatar
+ 4
Means return nothing....
21st Nov 2019, 11:02 AM
Dan Rhamba
Dan Rhamba - avatar
+ 1
Without value, wouldn't that mean 'undefined'?
21st Nov 2019, 11:44 AM
HonFu
HonFu - avatar