Use of Null


Where do we need to use Null datatypes?


Well, for example in a database where we have a field which isn’t required.

or MDN this example:

function getVowels(str) {
  var m = str.match(/[aeiou]/gi);
  if (m === null) {
    return 0;
  return m.length;


re.match (which does pattern matching), returns null when there is no match.

null certainly has it uses, which you will see as you continue programming


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.