js: the difference between return [expression], return false, return true, return

1、return [ expression ] 

2, return false, prevent the default behavior,

  ① When binding a click event to the a tag, because the a tag has a default click event, and you don't want it to perform the default behavior, you can use return false to prevent it

   ②The default submission behavior of the form form

3. return true will continue the operation

4. Separate return, the following code will not continue to execute, return in advance

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324850816&siteId=291194637