JS
challenger
JS
challenger
  • Getting Started
  • Overview
  • Random Challenge
  • Javascript Basics
  • Javascript Arrays
  • Javascript Objects
    • - Accessing object properties one
    • - Accessing object properties two
    • - Accessing object properties three
    • - Check if property exists in object
    • - Creating Javascript objects one
    • - Creating Javascript objects two
    • - Creating Javascript objects three
    • - Extract keys from Javascript object
    • - Sum object values
    • - Remove a property from an object
    • - Merge two objects with matching keys
    • - Multiply all object values by x
    • - Swap object keys and values
    • - Replace empty strings in object with null values
    • - Extracting information from objects
    • - Add property to each object in array
    • - Convert array to object with counter
  • Javascript Dates
  • Javascript Sets
  • Javascript DOM
    NEW
  • Challenge Rush
Imprint Privacy Policy

Creating Javascript objects one

// Write a function that a string (a) as argument
// Create an object that has a property with key 'key' and a value of a
// Return the object
function
myFunction
(
a
)
{

return
}
Test Cases:
myFunction('a')
Expected
{key:'a'}
myFunction('z')
Expected
{key:'z'}
myFunction('b')
Expected
{key:'b'}
Twitter_Logo_White-on-Blue
Follow