Latest courses
Staff picks
/* Design Pattern */
function switchFunction(num: number):string { let b: string = "functionb"; switch (num) { case 1: { let b: string = "case 1"; break; } // After break case 2: { let b: string = "case 2"; } // Before break break; }
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY']; let arr2; (function() { arr2 = [...arr1]; // change this line arr1[0] = 'potato' })(); console.log(arr2);
class SpaceShuttle { constructor(targetPlanet){ this.targetPlanet = targetPlanet; } } var zeus = new SpaceShuttle('Jupiter'); console.log(zeus.targetPlanet) function makeClass() { class Vegetable { constructor(name){
Popular instructors
Recently published
<html> <head></head> <body> </body> </html>
<html> <head> <link rel="stylesheet" href="index.css"> </head> <body> <h1>index.html</h1> <script src="index.pack.js"></script> </body> </html>
<html> <head> <link rel="stylesheet" href="index.css"> </head> <body> <h1>index.html</h1> <script src="index.pack.js"></script> </body> </html>
// The prime factors of 13195 are 5, 7, 13 and 29. // What is the largest prime factor of the given number? function largestPrimeFactor(number) { let largestPrime = 0; const isPrime = num => { for(let i = 2; i < num; i++) { if(num % i === 0) { return false; } } return true;