Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 481 Bytes

create-object-from-string.md

File metadata and controls

13 lines (10 loc) · 481 Bytes

Create object from string

Write a function that creates an Object from the given string with the characters as keys and the values as 'true' for the given key. The function should return the consturcted Object.

function createObject(str){
// write your code here
}
console.log(createObject("hello")); // {'h' :true, 'e' :true, 'l' :true, 'o' :true}
console.log(createObject("aeroplane"));//{'a': true, 'e' :true,'r' :true, 'o' :true, 'p' :true, 'l' :true,'n' :true}