Created
July 4, 2018 07:10
-
-
Save asiniy/758d0587cf936ddfe93f6fa726a11d5d to your computer and use it in GitHub Desktop.
Rubyish Hash#Fetch # Extending JavaScript with ease (beginner level tutorial)
This file contains 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
o = { a: 'b' } | |
o.fetch(:a) # => returns 'b' | |
o.fetch(:nonexistant) # => throws prog.rb:2:in `fetch': key not found (KeyError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment