Habr
All streams
Search
Edit
Settings
Login
Pull to refresh
3
Василий
@gbazil
Разработчик
1
Subscribers
Follow
Send message
Profile
Articles
1
Posts
News
Comments
1
More
Dropdown
Bookmarks
Followers
Following
Copy RSS link
Экспорт, импорт в Node.JS
gbazil
Feb 8 2016 at 12:40
А так сработоет:
в модуле
module.exports = function() { return «I have not a name»; }
module.exports.abc = ['a', 'b', '!'];
далее в другом файле
var f = require('./module.js');
var str = f();
str += f.abc[2];
console.log(str); // печатает: I have not a name!
Что мне и было нужно.
Рад, что у Вас не возникает таких заморочек )
Information
Rating
Does not participate
Location
Москва, Москва и Московская обл., Россия
Registered
December 15 2013
Activity
September 30 2025 at 08:45
в модуле
module.exports = function() { return «I have not a name»; }
module.exports.abc = ['a', 'b', '!'];
далее в другом файле
var f = require('./module.js');
var str = f();
str += f.abc[2];
console.log(str); // печатает: I have not a name!
Что мне и было нужно.
Рад, что у Вас не возникает таких заморочек )