Ad
  • Custom User Avatar

    No, this is more on the logic analysis and grammar literacy side of things. So, you as an observer are able to identify four types of dinasors and 3 types of food.

    Based on these info, you know that both brachiosaurus and the triceratops are herbivores (vegetarians), with an exception that triceratops cannot eat leaves. The same goes for omnivores (T-Rex and velociraptor) cannot eat flowers and leaves.

    So, if such an exception happens, you replace the dinosaur with Something as it would not make sense to say a herbivore is eating a dead dino or an omnivore is eating plants.

    However, for the case of vvvvvvvvvvv, you are able to identify the dinosaur being velociraptor, just not what he is eating on. So, your statement of saying A velociraptor is eating something is entirely true, hence you do not need to replace A velociraptor with Something. Hope it makes sense ^^

  • Custom User Avatar
  • Default User Avatar

    The Kata is asking for the possible combinations of one red and two blues, but ONLY cares about the position of the red.

  • Custom User Avatar
    [B, R, B, B, R, B, R]
     ^^^^^^^                <-- 1
              ^^^^^^^       <-- 2
    
  • Default User Avatar

    Thx. I will update.

  • Default User Avatar

    The examples given are an important part of the description. You don't think they suffice?

  • Custom User Avatar

    the error was parsing your code. You should not use function keyword since it's a ES6 class if you want to use ES5 version you should use this template to do the same:

    "use strict";
    
    var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
    
    function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
    
    var FileNameExtractor = function () {
        function FileNameExtractor() {
            _classCallCheck(this, FileNameExtractor);
        }
    
        _createClass(FileNameExtractor, null, [{
            key: "extractFileName",
            value: function extractFileName(dirtyFileName) {
                // your code here
            }
        }]);
    
        return FileNameExtractor;
    }();
    
  • Custom User Avatar

    there's an error on cw will check it later, but for now it seems that you are not extracting the result just testing the structure

  • Custom User Avatar

    please share your solution and mark it as spoiler so we can check what's happening.

  • Default User Avatar

    Found this on SO:

    'for..in will loop over all own and inherited properties of the array object which aren't DontEnum; that means if someone adds properties to the specific array object (there are valid reasons for this - I've done so myself) or changed Array.prototype (which is considered bad practice in code which is supposed to work well with other scripts), these properties will be iterated over as well; inherited properties can be excluded by checking hasOwnProperty(), but that won't help you with properties set in the array object itself.'

    So thats why it was counting 'shuffle' and adding the extra element.

    I think that you could have used a 'for...of' loop and it would have worked.

  • Default User Avatar
  • Custom User Avatar

    Hey, thanks to all of you for helping out! I don't do JS either that much, much more a C family guy, so any help at all is good!

    I'll try the rewrite suggested.

  • Default User Avatar

    Ha yeah. Seems the tests aren't made the better way, so. Too bad there are already too much completions to modify them...

  • Default User Avatar

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

  • Default User Avatar

    @Avanta: yeah, that's it. But the real question is (to me), why doing it this way cause the extra element at the end? Do you know? (Note: with a spoiler flag, he cannot read your comment. / @ DuhbleB: it's almost the same than mine, anyway (well in a more explicit manner, yes ;) )

  • Loading more items...