0
0
SASSmarkup~10 mins

sass:map module - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the value of the key 'color' from the map.

SASS
$theme: ("color": "blue", "font": "Arial");
$value: map[1]($theme, "color");
Drag options to blanks, or click blank then click option'
A.get
B.get()
Attempts:
3 left
💡 Hint
Common Mistakes
Adding parentheses after the dot like map.get() which causes syntax errors.
2fill in blank
medium

Complete the code to check if the key 'font' exists in the map.

SASS
$theme: ("color": "blue", "font": "Arial");
$exists: map[1]($theme, "font");
Drag options to blanks, or click blank then click option'
A.contains
B.has()
C.exists
D.has
Attempts:
3 left
💡 Hint
Common Mistakes
Using map.contains or map.exists which are not valid functions.
3fill in blank
hard

Fix the error in the code to add a new key 'size' with value 'large' to the map.

SASS
$theme: ("color": "blue", "font": "Arial");
$theme: map[1]($theme, "size", "large");
Drag options to blanks, or click blank then click option'
A.put
B.set
C.insert
D.add
Attempts:
3 left
💡 Hint
Common Mistakes
Using map.add or map.put which do not exist.
4fill in blank
hard

Fill both blanks to create a new map with only keys that have values longer than 3 characters.

SASS
$theme: ("color": "blue", "font": "Arial", "size": "lg");
$filtered: map.filter($theme, ($key, $value) -> str[1]($value) [2] 3);
Drag options to blanks, or click blank then click option'
A.length
B>
C<
D.size
Attempts:
3 left
💡 Hint
Common Mistakes
Using str.size which is not a valid function.
Using < instead of > which filters the wrong values.
5fill in blank
hard

Fill all three blanks to create a new map with keys uppercased and values unchanged, only for keys that contain the letter 'o'.

SASS
$theme: ("color": "blue", "font": "Arial", "size": "large");
$filtered: map.filter($theme, ($key, $value) -> str[1]($key, "o") [2] 0);
$result: map.map($filtered, ($key, $value) -> ([3]: $value));
Drag options to blanks, or click blank then click option'
A.index
B>
C$key.uppercase()
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using str.index-of instead of str.index.
Using wrong comparison like < or == null.
Using str.contains which does not exist in Sass.
Not uppercasing keys correctly.