Starting from:

$30

CS Homework 1 Solution

Goals: Review visual channels, Javascript types, data structures, and JSON.

Your work should be in the form of an HTML file called index.html with one <p> element per problem. Wrap any Javascript code for each problem in a <script> element nested within the <p> element.

For example:

<html><body>

<p id="p0">

Problem 0: We use a "let" statement to...

<script>

let x = 100;

</script>

</p>

</body></html>

Create a zip archive containing this file and upload it to CMS before the deadline. Please check to make sure that the data uploaded are what you intend to submit.

    1. For each of the following visualizations, identify the marks used and visual channels employed from the list provided. Be as exhaustive as possible. You do not need to supply the precise data attribute – you only need to write the marks and visual channels used.

Possible visual channels:

Aligned Position (x or y); Unaligned Position (x or y); Aligned Length; Unaligned Length; Area; Volume; Color Hue; Color luminosity;

EXAMPLE:














Marks: Blue rectangles

Channels: Varying the vertical aligned length and horizontal aligned position of rectangles
A)





























B)
C)








































(Note: The row of numbered items at the top (1.SS, 2.CoS, etc.) are individual books in the series. Word position continues through the entire series of books from start to end)


    2. For each of the following items in the list, please:

        A: Identify whether it is a canonical Javascript type

        B: If the type is a canonical Javascript type, please provide an example in your <script> section using console.log(typeof( ... )).

        C: If applicable, identify any unusual or unexpected typeof() behavior for the type.

a) number;    b) int;    c) unicode;    d) array;    e) char;    f) class;

g) regex;    h) string;    i) boolean;    j) object;    k) null;    l) function




(next page)
    3. First, in 1-2 sentences, please define type coercion. Then, in your <p> tag please provide two examples where type coercion produces an answer that is unusual or unexpected (i.e. different from Python output or a case where Python would throw an exception). For each sample, briefly explain why it is unexpected. Then, in the <script> section put both of your code examples into of a console.log() statement so we can see the result (e.g.

console.log("apple" + "orange") )




    4. Describe, in your own words, the course policy on late and unreadable work outlined in the syllabus, which is linked from the course website.

More products