Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active August 11, 2021 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/beaae8ffc61d2f66679788ff1f407282 to your computer and use it in GitHub Desktop.
Save McLarenCollege/beaae8ffc61d2f66679788ff1f407282 to your computer and use it in GitHub Desktop.
construct Object From String

Given a string, return an Object whose keys are the characters and the values are the frequency of each the character present in the string. For eg.

let str = "vivek";
function buildObjectFromString(str){
// write your code here
}
buildObjectFromString(str);
// should return 
{
 "v" :2,
 "i" :1,
 "e" :1,
 "k" :1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment