This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Write a function charFreq() that takes a string and builds a frequency listing of the characters contained in it. | |
// Represent the frequency listing as a Javascript object. | |
// Try it with something like charFreq("abbabcbdbabdbdbabababcbcbab"). | |
// I got a lot help from stack on this one. I had no idea how to make a object from a string. | |
// and in doing research for that I found a solution to something similar to this. But I do understand | |
// how every line of code works and why! | |
function charFreq(source) { | |
var frequency = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Represent a small bilingual lexicon as a Javascript object in the following fashion {"merry":"god", "christmas":"jul", "and":"och", "happy":gott", "new":"nytt", "year":"år"} and use it to translate your Christmas cards from English into Swedish. | |
var greetings = { | |
"merry": "god", | |
"christmas": "jul", | |
"and": "och", | |
"happy": "gott", | |
"new": "nytt", | |
"year": "ar" | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your code here |