5 kyu

Function Coercion Errors

Description:

When you're learning JavaScript, it can be easy to forget to "call" a function, to add those two little brackets () to the end of the function name, and the value of the function is coerced. The problem is, no error is thrown.

Now, there are cases when you'd want to use this functionality. But for this kata, let's assume any time a function is coerced, it means something unintended happen. Your job is to throw an error whenever such a coersion would occur.

function fn() { }
var a = fn;

a === fn; // true
fn < 1; // error
+fn; // error
Language Features

Stats:

CreatedApr 16, 2015
PublishedApr 16, 2015
Warriors Trained395
Total Skips43
Total Code Submissions945
Total Times Completed121
JavaScript Completions121
Total Stars7
% of votes with a positive feedback rating88% of 54
Total "Very Satisfied" Votes43
Total "Somewhat Satisfied" Votes9
Total "Not Satisfied" Votes2
Total Rank Assessments16
Average Assessed Rank
5 kyu
Highest Assessed Rank
3 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • wthit56 Avatar
  • Voile Avatar
  • trashy_incel Avatar
Ad