Skip to content

Instantly share code, notes, and snippets.

// 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 = {};
// 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"
};
@kunalbhatt
kunalbhatt / card.rb
Created October 25, 2012 21:58 — forked from dbc-challenges/card.rb
FlashCardinator
# Your code here