<<<<<<< HEAD Code Wars - Brett Crafton

Semi-Optional

Question

We have implemented a function wrap(value) that takes a value of arbitrary type and wraps it in a new JavaScript Object or Python Dict setting the 'value' key on the new Object or Dict to the passed-in value. Unfortunately, the code is not working as designed. Please fix the code so that it behaves as specified. So, for example, if we execute the following code:

wrapper_obj = wrap("my_wrapped_string"); # wrapper_obj should be {"value":"my_wrapped_string"} //We would then expect the following statement to be true: wrapper_obj["value"] == "my_wrapped_string"

Solution by -

My Solution


	function wrap(value) {
		this.value = value
		return this
		}
				

Try it yourself - CodeWars

======= Code Wars - Brett Crafton

Semi-Optional

Question

We have implemented a function wrap(value) that takes a value of arbitrary type and wraps it in a new JavaScript Object or Python Dict setting the 'value' key on the new Object or Dict to the passed-in value. Unfortunately, the code is not working as designed. Please fix the code so that it behaves as specified. So, for example, if we execute the following code:

wrapper_obj = wrap("my_wrapped_string"); # wrapper_obj should be {"value":"my_wrapped_string"} //We would then expect the following statement to be true: wrapper_obj["value"] == "my_wrapped_string"

Solution by -

My Solution


	function wrap(value) {
		this.value = value
		return this
		}
				

Try it yourself - CodeWars

>>>>>>> 0e614172debaa009c8d31330edbeb3b765b59c39