Ad
  • Custom User Avatar

    So calling two separate where-filters is a logical AND, while combining two where-filters in one where-call is an OR?

    // SELECT studentName, teacherName FROM teachers, students WHERE teachers.teacherId = students.tutor AND tutor = 1
    query().select(student).from(teachers, students).where(teacherJoin).where(tutor1).execute(); //[{"studentName":"Michael","teacherName":"Peter"}] <- AND filter
    // SELECT * FROM number WHERE number < 3 OR number > 4
    query().select().from(numbers).where(lessThan3, greaterThan4).execute(); //[1, 2, 5, 7] <- OR filter

  • Custom User Avatar

    The last test from Numbers tests. It uses two conditions in where statements as logical OR instead of logical AND.
    Please update the description of the task accordingly.

  • Custom User Avatar

    A Functional Programming kata with array mutation!
    That's weird.
    Don't waste your time on it!

  • Custom User Avatar

    More better now ;-)

  • Custom User Avatar

    It can be dangerous in this case if, for example, you are executing this code on your server based on user input.

  • Custom User Avatar

    its only dangerous when missusing it :) often peapole dont even know that they us it, because its hidden in other functions ;)

  • Custom User Avatar

    This is not a JS problem. It is a floating point problem, it happens on other languages.

  • Custom User Avatar

    0.2 + 0.1 == 0.30000000000000004
    It's a well known issue of JS itself

  • Custom User Avatar

    just a try, for 0.1+0.2=0.3
    but it doesn't work

  • Custom User Avatar

    You should not be using eval, it is dangerous.

  • Custom User Avatar

    It's not perfect ;-)
    Try that:

    it("should sum only numbers and calculate the correct number", function(){
        Test.assertEquals(sum([5, '3', 2, '$', 1, NaN]), 8, "Sum equals to 8");
        Test.assertEquals(sum(['3', 0.2, '$', 0.1]), 0.3, "Sum equals to 0.3");
    });