Programming Questions

  • Newest
  • Popular Tags
  • Ask A Question
  • Is return the same as return null
    Is
     return; 
    same as
    return null;
    please answer.. thanks :)
    electro7bug posted this question on 1/16/14 | javascript, return, value, null
    Answers
  • +
  • 6
  • -
  • No. When nothing is specified the default value is "undefined", except for constructors, where the default return value is "this". In effect you have returned a variable for which no value is assigned. When you return null you are actually assigning the special value null, which represents the concious decision to the thing you are returning as non-existant.
    Log in to write an answer.