To complete this, learners should have knowledge of the following JavaScript concepts:
- Basic data types
- Arithmetic operators
- String concatentation
- Using
console.log
to output information
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace LearnLINQ | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ |
// Prompt | |
// Use a loop to print the even numbers from 0 to 10. | |
// Option 1 | |
for(let i = 0; i < 12; i +=2 ) { | |
console.log(i); | |
} | |
// Option 2 | |
for (let i = 0; i < 11; i++) { |
// Prompt | |
// Print the number and title for each value in titles. Make sure that the first in the list is 1, not 0. | |
// Option 1 | |
titles = ['The Philosopher\'s Stone', 'The Chamber of Secrets', 'The Prisoner of Azkaban', 'The Goblet of Fire', 'The Order of the Phoenix', 'The Half-Blood Prince', 'The Deathly Hallows']; | |
for (let i = 0; i < titles.length; i++) { | |
console.log(`${i+1}. ${titles[i]}`); | |
} |
// Prompt | |
// Use string concatenation or interpolation to print creature in a sentence. It should look like this: A wild Golem appeared! | |
// Option 1 | |
const creature = 'Golem'; | |
console.log(`A wild ${creature} appeared!`); | |
// Option 2 | |
const creature = 'Golem'; | |
console.log('A wild ' + creature + ' appeared!') |
/* | |
Prompt: | |
Work is piling up! Add 8 to tasks and print it to the console. | |
*/ | |
// Option 1 | |
let tasks = 2; | |
tasks = tasks + 8; | |
console.log(tasks); |
using System; | |
namespace ArchitectArithmetic | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("What monument would you like to work with?"); | |
Console.Write("Choose Teotihuacan (1), Taj Mahal (2), or Great Mosque of Mecca (3): "); |
using System; | |
class MainClass { | |
public static void Main (string[] args) { | |
if (args.Length == 0) | |
{ | |
Console.WriteLine("in if..."); | |
CallMain(); | |
} | |
else { |
using System; | |
namespace ConsoleCreatures | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
Console.WriteLine(" .-."); | |
Console.WriteLine("(o o)"); |
// Tests for basic variable definition | |
if (!Components.CodeEditor.codeContains('Program.cs', /int\s+totalEmployees\s*=\s*86928\s*;/)) { | |
return { | |
pass: false, | |
errors: { | |
friendly: 'Did you define an `int` named `totalEmployees` with the value `86928`?', | |
component: 'PersistentCodeEditor' | |
} | |
}; |