Functions #2

Run Settings
LanguageJavaScript
Language Version
Run Command
const window = {}; const a = 'main'; const b = 'func'; window[a] = 5; window[b] = function(){ console.log(this[a]); } require('./middleware')(window.main); window[b](); console.log(window); console.log('---'); // ==== Next example const main = require('./params'); function socialMemos(options, ctrl){ const innerFunc = function() { console.log(options.a, ctrl.b) }; console.log(arguments); return innerFunc(); } socialMemos(main.options, main.controller); console.log('---'); // ==== Next example (function(param){ console.log(param) })(main.options.a) console.log('---'); // ==== Next example const formItem = require('./pente'); // formItem
module.exports = function(a){ return console.log(a+1); }
const options = { a: 'Yeah' }; const controller = { b: 'Done' }; module.exports = { options: options, controller: controller };
"use strict"; handleEdit = function handleEdit(user) { return function (event) { setState({ name: user.name, Email: user.email, firstName: user.firstName, lastName: user.lastName }); event.preventDefault(); }; };
const formItem = (name, param, funcArray) => { // const item = param.toString(); const item = name.split("").reverse().join("")[0] name[0] == 'm' ? funcArray[0](item) : funcArray[1](item); }; function monthDecorator(item){ console.log('Месяц '+item); } function kvDecorator(item){ console.log('Квартал '+item); } const m1 = '0.15'; // formItem('k1', m1, [monthDecorator, kvDecorator]); module.exports = formItem;
const store = function(){ const state = new Map(Object.entries({ authorized: false, user: null, pass: null })); function getState() { return state; } return { state, getState }; }; console.log(store().getState());
Editor Settings
Theme
Key bindings
Full width
Lines