When i try to execute the js file from cmd line, i am getting this error. I am not sure whether we can give the keys like that.
const App42 = require('./js/App42-all-1.6.min');
const mod = require('./js/buddy');
module.exports = {
var API_KEY = '014883a05a4902889c860272b3c4*******568072cf82cfc31a42c165f0f8cc6';
var SEC_KEY = 'b3b2df57b86a7fdabe66a96a*******7e04fbd95c6ddef942a3c844878eafbf05';
App42.initialize(API_KEY,SEC_KEY);
hello: function() {
return "Hello";
}
}
The error i am getting is :
LB.js:6
var APIKEY = '014883a05a4902889c860272b3c2170ae145*****2cf82cfc31a42c165f0f8cc6';
^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
Before giving down votes can some one say the solution. This is not how you respond to a new user trying to learn js.
You're exporting an object, yet you have an invalid object syntax:
You should just be exporting keys and values for the object. So depending on what you want to actual 'export' you could try
When you then
require
this file you can access various properties and functions such asYou can read more about objects here