Skip to content

Instantly share code, notes, and snippets.

@LESTADru
Created May 9, 2014 08:09
Show Gist options
  • Save LESTADru/b94217f2a59d59b23c21 to your computer and use it in GitHub Desktop.
Save LESTADru/b94217f2a59d59b23c21 to your computer and use it in GitHub Desktop.
Функция отличающая переданный аргумент от undefined.
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>в функции отличить отсутствующий аргумент от undefined</title>
</head>
<body>
<script>
'Use strict'
function f(x){
alert( arguments.length == 0?0:1 );
}
f(undefined);
f();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment