JavaScript, , |
let a = {
'myKey': 'myValue'
}
let key = 'constructor'; // comes from outside source
let b = a[key] || 'defaultValue';
expect(b).to.be.equal('defaultValue'); // fails
const result = {};
for (var prop of Object.getOwnPropertyNames(Object.prototype)) {
result[prop] = undefined;
}
return result;
// file1
export function myFunction(){}
// file2
export class myClass{}
export * from './file1';
export * from './file2';
//
import { myFunction } from './folder/file1';
import { myClass } from './folder/file2';
//
import { myFunction, myClass } from './folder';
import { myClass } from '.';
export function myFunction(){ // doSmth with class }