Sunday, 19 March 2017

How to pass variable from one function to another function in node.js?

In my case, I want to pass the topic_to_learn variable to the 2nd function and use it in the 2nd function for something else....

        function (session, args, next) {
        var topic_to_learn = builder.EntityRecognizer.findEntity(args.entities, 'topic_to_learn');
        builder.Prompts.text(session, 'Sure, can you please also tell me about your goals or anything you want to achieve after learning about this topic?');
    },
    function (session, results, next) {
        var learning_goals = results.response;
        session.send('Got it, let me think...', session.message.text);
        session.send('Voila! These are the articles related to ' + topic_to_learn, session.message.text);
    },



via Carson Yau

No comments:

Post a Comment