8 kyu
The 'if' function
14,201 of 34,190user578387
Description:
Create a function called _if
which takes 3 arguments: a value bool
and 2 functions (which do not take any parameters): func1
and func2
When bool
is truthy, func1
should be called, otherwise call the func2
.
Example:
_if(true, function(){console.log("True")}, function(){console.log("false")})
// Logs 'True' to the console.
Functional Programming
Fundamentals
Similar Kata:
Stats:
Created | Sep 13, 2014 |
Published | Sep 13, 2014 |
Warriors Trained | 57968 |
Total Skips | 4695 |
Total Code Submissions | 101337 |
Total Times Completed | 34190 |
JavaScript Completions | 14201 |
Ruby Completions | 1150 |
Python Completions | 11236 |
CoffeeScript Completions | 119 |
Haskell Completions | 876 |
Elixir Completions | 327 |
C++ Completions | 3459 |
Rust Completions | 1057 |
C# Completions | 1700 |
Lua Completions | 481 |
C Completions | 1124 |
NASM Completions | 76 |
Java Completions | 330 |
Total Stars | 325 |
% of votes with a positive feedback rating | 75% of 3180 |
Total "Very Satisfied" Votes | 2043 |
Total "Somewhat Satisfied" Votes | 661 |
Total "Not Satisfied" Votes | 476 |