【发布时间】:2019-07-08 19:56:54
【问题描述】:
我正在做一个 Angular 项目。单选按钮应用于创建健身计划。我为 Stackblitz.to 写了一个例子。
https://stackblitz.com/edit/angular-dfcnkc
我有几个数组,我希望根据我的选择给出完美的答案。
homeBreast = ['exercise1', 'exercise2', 'exercise3'];
homeBiceps = ['exercise1', 'exercise2', 'exercise3'];
homeTriceps = ['exercise1', 'exercise2', 'exercise3'];
breast = ['exercise1', 'exercise2', 'exercise3'];
biceps = ['exercise1', 'exercise2', 'exercise3'];
triceps = ['exercise1', 'exercise2', 'exercise3'];
homeTwice1 = [this.homeBiceps, this.homeTriceps]
homeTwice2 = [this.homeBreast]
twice1 = [this.biceps, this.triceps]
twice2 = [this.breast]
homeThrice1 = [this.homeBiceps]
homeThrice2 = [this.homeBreast]
homeThrice3 = [this.homeTriceps]
thrice1 = [this.biceps]
thrice2 = [this.breast]
thrice3 = [this.triceps]
例如:如果我使用“你想多久去一次火车?答案:2”和“我想训练答案:在家”,这应该被删除。
// for the first day in the week
homeTwice1 = [this.homeBiceps, this.homeTriceps]
// for the second day of the week
homeTwice2 = [this.homeBreast]
当我检查答案“3”和“在健身房”时,输出应该是这样的
// for the first day in the week
thrice1 = [this.biceps]
// for the second day of the week
thrice2 = [this.breast]
// for the third day in the week
thrice3 = [this.triceps]
有没有人有提示或想法如何让我做得更好?
【问题讨论】:
标签: jquery arrays angular typescript output