 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JavaScript outsider function call and return the result
Use the return keyword for outsider function call. Following is the code −
Example
var substractMethod = function () {    var firstValue =1000, thirdValue= 200;    var divideMethod = function (){       var secondValue =500;       console.log("The result of       divideMethod()="+(firstValue/secondValue));       return (firstValue-secondValue);    }    return divideMethod; } var result = subtractMethod(); console.log("The result of substractMethod()="+result()); To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo198.js.
Output
This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo198.js The result of divideMethod()=2 The result of subtractMethod()=500
Advertisements
 