SoFunction
Updated on 2025-03-01

js return returns multiple values, accessing methods through the object's properties

Return returns multiple values, accessed through the object's properties

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style></style>
  <script>  
  function add(a,b){
    var sum;
    var sub
    return{
      sum:a+b,
      sub:a-b
    }
  }
  var obj = add(5,2);
  ();
  ();

  </script>
</head>
<body>

</body>
</html> 

The above article js return returns multiple values. The method of accessing the object's attributes is all the content I share with you. I hope you can give you a reference and I hope you support me more.