Randell Dawson 05f73ca409 fix(curriculum): Convert blockquote elements to triple backtick syntax for JavaScript Algorithms and Data Structures (#35992)
* fix: convert js algorithms and data structures

* fix: revert some blocks back to blockquote

* fix: reverted comparison code block to blockquotes

* fix: change js to json

Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* fix: convert various section to triple backticks

* fix: Make the formatting consistent for comparisons
2019-05-17 08:20:30 -05:00

2.6 KiB

id, title, challengeType, videoUrl
id title challengeType videoUrl
bd7123c9c443eddfaeb5bdef Declare JavaScript Variables 1 https://scrimba.com/c/cNanrHq

Description

In computer science, data is anything that is meaningful to the computer. JavaScript provides seven different data types which are undefined, null, boolean, string, symbol, number, and object. For example, computers distinguish between numbers, such as the number 12, and strings, such as "12", "dog", or "123 cats", which are collections of characters. Computers can perform mathematical operations on a number, but not on a string. Variables allow computers to store and manipulate data in a dynamic fashion. They do this by using a "label" to point to the data rather than using the data itself. Any of the seven data types may be stored in a variable. Variables are similar to the x and y variables you use in mathematics, which means they're a simple name to represent the data we want to refer to. Computer variables differ from mathematical variables in that they can store different values at different times. We tell JavaScript to create or declare a variable by putting the keyword var in front of it, like so:
var ourName;

creates a variable called ourName. In JavaScript we end statements with semicolons. Variable names can be made up of numbers, letters, and $ or _, but may not contain spaces or start with a number.

Instructions

Use the var keyword to create a variable called myName. Hint
Look at the ourName example if you get stuck.

Tests

tests:
  - text: You should declare <code>myName</code> with the <code>var</code> keyword, ending with a semicolon
    testString: assert(/var\s+myName\s*;/.test(code), 'You should declare <code>myName</code> with the <code>var</code> keyword, ending with a semicolon');

Challenge Seed

// Example
var ourName;

// Declare myName below this line

After Test

if(typeof myName !== "undefined"){(function(v){return v;})(myName);}

Solution

var myName;