https://www.codewars.com/kata/descending-order/train/javascript ´´´javascript function descendingOrder(n){ return parseInt(n.toString().split("").sort().reverse().join("")); } ´´´
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
class Rock | |
def method_missing(m, *args, &block) | |
if m == :swim | |
puts 'Learning how to swim' | |
self.create_method(:swim) { 'Sinks quickly' } | |
end | |
end | |
def create_method(name, &block) | |
self.class.send(:define_method, name, &block) | |
end |
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
class Duck | |
def quack | |
'Quack!' | |
end | |
def swim | |
'Quack paddle and quack and paddle...' | |
end | |
end |
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
class Duck | |
def quack | |
'Quack!' | |
end | |
def swim | |
'Paddle paddle paddle...' | |
end | |
end |
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
class DomesticDuck | |
def quack | |
'Quack!' | |
end | |
def swim | |
'Paddle paddle paddle...' | |
end | |
end | |