File tree 2 files changed +43
-0
lines changed
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ < meta charset ="UTF-8 " />
4
+ < title > 출력결과</ title >
5
+ </ head >
6
+ < body >
7
+ < script >
8
+ function solution ( a , b ) {
9
+ let answer = "" ;
10
+
11
+ a . forEach ( ( ele , index ) => {
12
+ if ( a [ index ] === b [ index ] ) {
13
+ answer = answer + "D " ;
14
+ }
15
+ if ( a [ index ] === 1 && b [ index ] === 2 ) {
16
+ answer = answer + "B " ;
17
+ }
18
+ if ( a [ index ] === 1 && b [ index ] === 3 ) {
19
+ answer = answer + "A " ;
20
+ }
21
+ if ( a [ index ] === 2 && b [ index ] === 1 ) {
22
+ answer = answer + "A " ;
23
+ }
24
+ if ( a [ index ] === 2 && b [ index ] === 3 ) {
25
+ answer = answer + "B " ;
26
+ }
27
+ if ( a [ index ] === 3 && b [ index ] === 1 ) {
28
+ answer = answer + "B " ;
29
+ }
30
+ if ( a [ index ] === 3 && b [ index ] === 2 ) {
31
+ answer = answer + " A" ;
32
+ }
33
+ } ) ;
34
+
35
+ return answer ;
36
+ }
37
+
38
+ let a = [ 2 , 3 , 3 , 1 , 3 ] ;
39
+ let b = [ 1 , 1 , 2 , 2 , 3 ] ;
40
+ console . log ( solution ( a , b ) ) ;
41
+ </ script >
42
+ </ body >
43
+ </ html >
You can’t perform that action at this time.
0 commit comments