 
  
   
  
  $('.new-game') добавляется динамически на страницу
.new-game в тот момент, когда вы его пытаетесь получить.Хотелось бы сделать универсальную функцию, чтобы можно было передавать в неё элемент...
var data = {
  fruits : [
    {
      src: 'http://.png',
      data : 'Apple'
    },
    {
      src : 'https://.png',
      data : 'Banana'
    }
  ],
  vegetables : [
    {
      src: 'http://.png',
      data : 'Carrot'
    },
    {
      src : 'https://.png',
      data : 'Potato'
    }
  ]
};
var groups = Object.keys(data);
console.log(groups); // ['fruits', 'vegetables']$sides: top,right,bottom,left;
@mixin borderClass($size,$side:all){
  $suffix: '';
  @if $side != all{
    $suffix: str-slice($side,0,1);
  }
  .b#{$suffix}-#{$size}{
    @each $i-side in $sides{
      @if $side == all or $i-side == $side{
        @include borderSide($i-side,$size);
      } @else{
        @include borderSide($i-side,0);
      }
    }
    border-image-source: none;
    border-image-slice: none;
    border-image-width: none;
    border-image-outset: none;
    border-image-repeat: none;
  }
}
@mixin borderSide($side,$size:0,$color:#000,$style:solid){
  border-#{$side}-color: $color;
  border-#{$side}-style: $style;
  border-#{$side}-width: $size*1px;
}
@for $i from 1 through 5{
  @each $side in $sides{
    @include borderClass($i,$side);
  }
  @include borderClass($i);
}.parent{
   position: relative;
}.star {    
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 13px;
    color: #fff;
}127.0.0.1       localhost       www.sublimetext.com
127.0.0.1       localhost       sublimetext.com 
  
  $('.box').each(function() { var thisLength = $('.box').length; console.log(thisLength); // всё ок });
$('.box').each(function() {
    var thisLength = $(this).text().length; // <- в этом месте
    console.log(thisLength);
});var zzz = $('.box').each(function() { var thisLength = $('.box').length; return thisLength; });
var zzz = $('.box').map(function() {
    return $(this).text().length;     
}).get(); 
  
   
  
  function getRandomSet(lo, hi, n) { // я привык к тому, что min и max - функции )))
    var res = new Set();
    while (res.size < n) res.add(Math.floor(Math.random() * (hi - lo + 1)) + lo);
    return res;
}
console.log(getRandomSet(0, 9, 5));function shuffle( array ) {
  for(var j, x, i = array.length; i; j = parseInt(Math.random() * i), x = array[--i], array[i] = array[j], array[j] = x);
    return true;
}
var a = [1,2,3,4,5,6,7,8,9];
shuffle(a);
out.innerHTML = a.toString();function getRandom(min, max) {
  var arr = [];
  for (var i = 0; i < max; i++) {
    x = Math.floor(Math.random() * (max - min + 1)) + min;
    if (arr.indexOf(x)) {
      return;
    }
    else {
      arr.push(x);
    }
    return arr;
  }
}function getRandom(min, max) {
  // Получаем массив чисел из диапазона от min до max
  var arr = Array.from(Array(max - min + 1).keys(), x => x + min);
  // Перемешиваем
  shuffle(arr);
  // возвращаем перемешанный массив
  return arr;
}var a = getRandom(3,15);test();var newTest = test;