Skip to content

Instantly share code, notes, and snippets.

@tetsunosuke
Created July 17, 2019 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tetsunosuke/5ec8ca2911c1b44b78bbaae11fc0b60e to your computer and use it in GitHub Desktop.
Save tetsunosuke/5ec8ca2911c1b44b78bbaae11fc0b60e to your computer and use it in GitHub Desktop.
// source https://jsbin.com
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var result = [];
var str;
for (var i = 0; i < 10000; i++) {
str = ("0000" + i).slice(-4);
if (
str.indexOf("9") !== -1
&&
str.indexOf("8") !== -1
&&
str.indexOf("7") !== -1
) {
result.push(str);
}
}
alert(result);
alert(result.length);
</script>
<script id="jsbin-source-javascript" type="text/javascript">var result = [];
var str;
for (var i = 0; i < 10000; i++) {
str = ("0000" + i).slice(-4);
if (
str.indexOf("9") !== -1
&&
str.indexOf("8") !== -1
&&
str.indexOf("7") !== -1
) {
result.push(str);
}
}
alert(result);
alert(result.length);</script></body>
</html>
var result = [];
var str;
for (var i = 0; i < 10000; i++) {
str = ("0000" + i).slice(-4);
if (
str.indexOf("9") !== -1
&&
str.indexOf("8") !== -1
&&
str.indexOf("7") !== -1
) {
result.push(str);
}
}
alert(result);
alert(result.length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment