回答編集履歴

1

return文いらなかったから削除したけど、なんか、かえって読みにくいかな……

2017/09/16 05:53

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア36074

test CHANGED
@@ -128,23 +128,19 @@
128
128
 
129
129
  function test(centerX, centerY, rectSize, fieldSize){
130
130
 
131
- return [...Array(fieldSize)].map( (_, y) => {
131
+ return [...Array(fieldSize)].map( (_, y) =>
132
132
 
133
- return [...Array(fieldSize)].map( (_, x) => {
133
+ [...Array(fieldSize)].map( (_, x) =>
134
134
 
135
- return (
135
+ ( y == (centerY - rectSize) || y == (centerY + rectSize) ) && (centerX - rectSize) <= x && x <= (centerX + rectSize)
136
136
 
137
- ( y == (centerY - rectSize) || y == (centerY + rectSize) ) && (centerX - rectSize) <= x && x <= (centerX + rectSize)
137
+ ||
138
138
 
139
- ||
139
+ ( x == (centerX - rectSize) || x == (centerX + rectSize) ) && (centerY - rectSize) <= y && y <= (centerY + rectSize)
140
140
 
141
- ( x == (centerX - rectSize) || x == (centerX + rectSize) ) && (centerY - rectSize) <= y && y <= (centerY + rectSize)
141
+ )
142
142
 
143
- );
143
+ );
144
-
145
- });
146
-
147
- });
148
144
 
149
145
  }
150
146