Ad
  • Default User Avatar

    How did you do that???

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Please use markdown formatting to make your code more readable.

  • Default User Avatar

    I just realized that and I came back here to say so. Well done fast reply, by the way.

    Also, I just realized I should have marked that as question.... Oh well.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I don't get why the name of the clerk needs to be kept as a variable.

    function Clerk(name){
      this.name = name;
      ...
    }
    

    I think instead it should be...

    function Clerk(){
      ...
    }
    ...
      var vasya = new Clerk();
    

    I also don't get why there are 3 (edit: 2.5???) functions instead of putting all of that in 1 function.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I agree.
    EDIT: Oh they have done that now, but I suggest that the either sample tests should have lowercase letters like that, the description should mention it, or the lowercase letter thing shouldn't be in full tests

  • Default User Avatar

    It's only running the first one of the tests. (sample tests) (javascript)

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    The first time I did "Attempt", I had a random test that failed but I couldn't figure out why. Attempting a second time, I didn't get the same problem. Can this be explained?

  • Default User Avatar
  • Default User Avatar

    Javascript: What's wrong with my code?
    I verified earlier that array2 is the original array, sortAscending is the array sorted in ascending order, and sortDescending is the array sorted in descending order, but for some reason it returns no for every test.

    function isSortedAndHow(array) {
      var array2 = array.concat();
      var sortAscending = array2.concat().sort(function(a, b){return a - b});
      var sortDescending = array2.concat().sort(function(a, b){return b - a});
      
      if (array2 === sortAscending){
        return "yes, ascending";
      } else if (array2 === sortDescending){
        return "yes, descending";
      } else {
        return "no";
      };
    };
    
  • Default User Avatar

    I found out that when a constant is an object, it's keys can be changed and you can change constant arrays in some ways, you just can't delete elemets. So if I can't keep a constant variable of what the original array is while keeping both sorted versions of the array, what can I do? Is there a different, better way to get that information?

    EDIT: Could the concat function be useful?

  • Default User Avatar

    But why did my contant variable get sorted without giving an error? I thought that const meant that the variable is a constant so it can't be changed, but apparently it did change; it was sorted. What should have happened in this code, is I get an error or something saying that I can't change constant variables. What instead happened is it returned array sorted in descending order.

  • Loading more items...