Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cars (input){
- const data={}
- const returnResult = {
- create:(name, inherit, parentName)=>{data[name]= inherit ? Object.create(data[parentName]):{}},
- set: (name, key, value)=>{data[name][key]=value},
- print: (name)=>{
- const entry = [];
- for(let key in data[name]) entry.push(`${key}:${data[name][key]}`);
- console.log(entry.join(','));
- },
- }
- const lines = input.forEach(line => {const [command, name, key, value] = line.split(" ");
- returnResult[command](name,key,value)});
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement