7 kyu

Building Strings From a Hash

7,445 of 13,374jhoffner

Description:

Complete the solution so that it takes the object (JavaScript/CoffeeScript) or hash (ruby) passed in and generates a human readable string from its key/value pairs.

The format should be "KEY = VALUE". Each key/value pair should be separated by a comma except for the last pair.

Example:

solution({a: 1, b: '2'}) // should return "a = 1,b = 2"
solution({a: 1, b: '2'}) # should return "a = 1,b = 2"
solution({"a" => 1, "b" => '2'}) # should return "a = 1,b = 2"
Kata.StringifyDict(new Dictionary<char, int> {{'a', 1}, {'b', 2}}) => "a = 1,b = 2";
let dict = [
    'a',1
] |> dict
let dictionary = new Dictionary<char,int>(dict)
solution dictionary == "a = 1"
solution({"a": 1, "b": '2'}) # should return "a = 1,b = 2"
solution(Map("a" -> 1, "b" -> 2)) // => a = 1,b = 2
Strings
Fundamentals

Stats:

CreatedJun 24, 2013
PublishedJun 24, 2013
Warriors Trained21216
Total Skips2819
Total Code Submissions65654
Total Times Completed13374
JavaScript Completions7445
CoffeeScript Completions653
Ruby Completions3497
C# Completions342
F# Completions48
Python Completions1807
Scala Completions15
Total Stars129
% of votes with a positive feedback rating86% of 1168
Total "Very Satisfied" Votes929
Total "Somewhat Satisfied" Votes161
Total "Not Satisfied" Votes78
Ad
Contributors
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • Chrono79 Avatar
  • Ze-Marcos Avatar
  • Souzooka Avatar
  • hobovsky Avatar
  • user8436785 Avatar
  • ejini战神 Avatar
  • Just4FunCoder Avatar
  • KayleighWasTaken Avatar
  • saudiGuy Avatar
Ad