将问题答案映射

时间:2016-10-28 14:22:13

标签: typescript

基于以下帖子:Rendering a dynamic survey

let questions = [{idquestion: 1, question:"age?"}, {idquestion: 2, question: "sex?"}];
let answers = [{idanswer: 1, answer:"17", idquestion: 1}, {idanswer: 2, question: "male", idquestion: 2}];
let questionanswer = {question: 'edad?', answer: '17'};
let questionsAndAnswers =
    questions.map(question => {question:question, answer: answers.find((answer) => answer.idquestion === question.idquestion)})

我收到以下错误:

question: unused label

answer: cannot find name answer

我想获得一个与问题和答案相关的对象questionAndAnswers。我该如何解决?

1 个答案:

答案 0 :(得分:1)

SELECT * FROM
(
    SELECT ID, KG_M=CAST(USER_3 AS decimal(14,2))  
    FROM PART 
    WHERE 
        ISNUMERIC(USER_3) = 1
)AS X
WHERE 
    X.KG_M >= 1.3

BTW功能编码风格很有趣,但这种方法感觉很脏。

http://codepen.io/amishstripclub/pen/wzbYoZ?editors=0010