Why isn’t this script working???

Code (text):

 

<script type="text/javascript">

function getAgeYears() {

"use strict";

var dobYear = 1987,

dobMonth = 1,

dobDay = 22,

now = new Date(),

nowYear = now.getFullYear(),

nowMonth = now.getMonth() + 1,

nowDay = now.getDate(),

yrAge = nowYear – dobYear;

if (nowMonth < dobMonth) {yrAge–; } else if (nowMonth === dobMonth && nowDay < dobDay) {yrAge–;

return yrAge; }

document.write(getAgeYears());

}

 

I will admit that I'm a novice coder, but I can't get this to work for the life of me….
Why isn't this script working???

See original post by solid7

Leave a Reply