Help us understand the problem. What is going on with this article?

# 0～2のランダムな数値を3つ取得し、「それぞれの数値」と「最も数値が大きい変数」の情報を表示。※「最も数値が大きい変数」が複数ある場合は複数表示

More than 1 year has passed since last update.
```<!DOCTYPE html>
<html lang="ja">
<meta charset="UTF-8">
<title>if&amp;3つの数値から最大値を求める</title>
<body>
<script>
var rand1 = Math.floor(Math.random() * 3);
var rand2 = Math.floor(Math.random() * 3);
var rand3 = Math.floor(Math.random() * 3);
document.write('<p>rand1: ' + rand1 + '</p>');
document.write('<p>rand2: ' + rand2 + '</p>');
document.write('<p>rand3: ' + rand3 + '</p>');

//３つがすべて同じ値の場合

if ( rand1 === rand2 && rand2 === rand3 ) {
document.write('<p>3つは同じ値です</p>');
}

if ( rand1 === rand2 ){
if ( rand2 >rand3) {
document.write('<p>一番値が大きいのはrand1とrand2です</p>');
}else {
document.write('<p>一番値が大きいのはrand3です</p>');
}
} else if (rand1 === rand3) {
if ( rand3 >rand2) {
document.write('<p>一番値が大きいのはrand1とrand3です</p>');
}else {
document.write('<p>一番値が大きいのはrand2です</p>');
}
} else if (rand2 === rand3) {
if ( rand3 >rand1) {
document.write('<p>一番値が大きいのはrand2とrand3です</p>');
}else {
document.write('<p>一番値が大きいのはrand1です</p>');
}
} else if ( rand1 > rand2 && rand1 > rand3 ) {
document.write('<p>一番値が大きいのはrand1です</p>');
} else if ( rand2 > rand3 && rand2 > rand1 ) {
document.write('<p>一番値が大きいのはrand2です</p>');
} else if ( rand3 > rand2 && rand3 > rand1 ) {
document.write('<p>一番値が大きいのはrand3です</p>');
}
</script>
</body>
</html>
```
Why do not you register as a user and use Qiita more conveniently?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away