Creating a dynamic JSON object based on user input

时间:2019-05-31 11:35:11

标签: javascript node.js json dynamic

I intend to write a function in Javascript where we dynamically create a JSON object based on the input that is given. Say, I give 3 arguments as input (colour, size, price) then a JSON object with these 3 attributes should be created. If I give 4 arguments (name,age,address,mobile) then it should create a JSON object with those 4 arguments. Is it possible? If not any other approaches to implement it in Javascript?

0 个答案:

没有答案