isAnswered()

The isAnswered() function (client-side and server-side) determines whether a question has been answered by the user.

Syntax

Use this syntax for the isAnswered() function:

            isAnswered('QUESTION_CODE'); 

          

Return Value

The isAnswered() function returns either true or false. If the specified question has one or multiple answers selected, the function returns true. Otherwise, it returns false.

Parameters

The isAnswered() function accepts the question code as a required string parameter. You can find it in the Code field on the question record.

Examples

The examples show how to use the isAnswered() function.

Determining the Answered State for a Question

This example determines whether a specific question, identified by its code, has been answered. The function returns true if a screen size has been selected for the "Select screen size" question, or false otherwise.

              const screenSizeAnswered = isAnswered('SCREEN_SIZE');
console.log(screenSizeAnswered); 

            

Related Topics

General Notices