function a() {
console.log('a');
}
function b() {
console.log('b');
}
function c() {
console.log('c');
}
let obj1 = {a:1}
let obj2 = {a:1, c:1}
let obj3 = {b:1, c:2}
Is this possible, write some code to execute function according to obj1 obj2 obj3
key?
example1 obj
1 then execute function a()
example2 obj2
then execeute function a()
and function c()
example3 obj3
then execute function b()
and function c()
I saw some package always create new object and pass an object in second parameter.
ex: let test = new B('test', { a: 10, b: 20 });
( B is a class )
It seen like execute something base on object key.