Basic JavaScript 030
// inline comment
/**
* block comment
*
*
*/// Example
var ourName;
var myName;
// Define myName below this line// Setup
var a;
var b = 2;
// Only change code below this line
a = 7;
b = a;Last updated
// inline comment
/**
* block comment
*
*
*/// Example
var ourName;
var myName;
// Define myName below this line// Setup
var a;
var b = 2;
// Only change code below this line
a = 7;
b = a;Last updated
// Example
var ourVar = 19;
// Only change code below this line
var a = 9;// Initialize these three variables
var a=5;
var b=10;
var c="I am a";
// Do not change code below this line
a = a + 1;
b = b + 5;
c = c + " String!";// Declarations
var studlyCapVar;
var properCamelCase;
var titleCaseOver;
// Assignments
studlyCapVar = 10;
properCamelCase = "A String";
titleCaseOver = 9000;var sum = 10 + 10;var difference = 45 - 33;var product = 8 * 10;var quotient = 66 / 33;var myVar = 87;
// Only change code below this line
myVar++;var myVar = 11;
// Only change code below this line
myVar--;var ourDecimal = 5.7;
// Only change code below this line
var myDecimal = 5.7;var product = 2.0 * 2.5;Divide one Decimal by Another with JavaScript// Only change code below this line
var remainder = 11 % 3 ;var a = 3;
var b = 17;
var c = 12;
// Only modify code below this line
a += 12;
b += 9;
c += 7;var a = 11;
var b = 9;
var c = 3;
// Only modify code below this line
a -= 6;
b -= 15;
c -= 1;var a = 5;
var b = 12;
var c = 4.6;
// Only modify code below this line
a *= 5;
b *= 3 ;
c *= 10;var a = 48;
var b = 108;
var c = 33;
// Only modify code below this line
a /= 12;
b /= 4;
c /= 11;function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit = celsius * (9/5) + 32;
// Only change code above this line
return fahrenheit;
}
// Change the inputs below to test your code
convertToF(30);// Example
var firstName = "Alan";
var lastName = "Turing";
// Only change code below this line
var myFirstName = "Chiu";
var myLastName = "Chi Wei";var myStr; // Change this line
myStr = "I am a \"double quoted\" string inside \"double quotes\".";var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';Code Output
\' 单引号 single quote
\" 双引号 double quote
\\ 反斜杠符 backslash
\n 换行符 newline
\r 回车符 carriage return
\t 制表符 tab
\b 退格符 backspace
\f 换页符 form feedvar myStr; // Change this line
myStr = 'FirstLine\n\\SecondLine\\\rThirdLine';// Example
var ourStr = "I come first. " + "I come second.";
// Only change code below this line
var myStr = "This is the start. " + "This is the end.";// Example
var ourStr = "I come first. ";
ourStr += "I come second.";
// Only change code below this line
var myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";// Example
var ourName = "Free Code Camp";
var ourStr = "Hello, our name is " + ourName + ", how are you?";
// Only change code below this line
var myName = "邱繼緯";
var myStr = "My name is" + myName + " and I am swell";// Example
var anAdjective = "awesome!";
var ourStr = "Free Code Camp is ";
ourStr += anAdjective;
// Only change code below this line
var someAdjective = "酷喔喔";
var myStr = "Learning to code is ";
myStr += someAdjective;// Example
var firstNameLength = 0;
var firstName = "Ada";
firstNameLength = firstName.length;
// Setup
var lastNameLength = 0;
var lastName = "Lovelace";
// Only change code below this line.
lastNameLength = lastName.length;