logo

Crowdly

You are given the section of code below, defining three variables. Based on y...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

You

are given the section of code below,

defining three variables. Based on your knowledge of javascript, what would you

describe the variable

pattern as (in one or two words)?

[2 marks]

let c =

document.getElementById("myCanvas");

let ctx = c.getContext("2d");

 

let pattern = [true,false,false,false,false,true,true,false,

               true,false,true,true,false,true,true,false,

               false,false,false,true,false,false,false,false,

               true,false,true,false,true,false,true,true,

               true,true,false,false,false,false,true,true,

               true,false,false,false,true,false,false,false,

               false,false,false,false,false,true,true,false,

               false,true,true,true,false,true,true,false,

               false,false,false,false,false,true,true,false];

 

The

variable pattern is used in order to draw a crossword puzzle (see image below). 

Why do you think the programmer has spread the variable over several lines? 

Would this cause a problem when running the program?

Explain your reasoning.

[4 marks]

Please answer all parts of the question.
More questions like this

Want instant access to all verified answers on modules.lancaster.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!