var today = new Date(); var yr = today.getFullYear(); var doNE = needYears - yr; doNETmp = doNE > 0 ? doNE.toString().replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ')+ " году" : "ваш вариант"; $(".itb_step_2_2").html(doNETmp);