Skip to content

Instantly share code, notes, and snippets.

@BernieGoll
Created June 13, 2018 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BernieGoll/6f120b9530626f3bdf543b0bdb7138c3 to your computer and use it in GitHub Desktop.
Save BernieGoll/6f120b9530626f3bdf543b0bdb7138c3 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/sepudic
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
// beginning JS exercises in JSBIN
/*
let a= 37;
let b= a * 2;
alert(b); // this is a pop up window
console.log(b); // this prints to the console screen
*/
// NEW PROBLEM -------------------
/*
let age = prompt('Please tell me your age:');
console.log(age);
*/
// NEW PROBLEM -------------------
/*
const taxRate = 0.07;
let amount = 99.99;
amount = amount * 2;
amount = amount + (amount * taxRate);
console.log(amount);
console.log(amount.toFixed (2));
*/
// NEW PROBLEM ------------------------------
// no arguement or parameter passed in here
//let amount = "99.99"; //throws an error since the 'toFixed' method looking for a number
//let amount = 99.99; // runs fine
/*
let amount = Number("99.99"); // runs fine; using explicit coercion so toFixed sees it as a number
printAmount();
function printAmount()
{
console.log( amount.toFixed(2));
}
*/
// NEW PROBLEM -----------------
/*
//function with arguement/parameter passed in
const taxRate = 0.10;
function calcFinalPrice(amt)
{
amt = amt + (amt * taxRate);
return amt;
}
var amount = 100.00;
amount = calcFinalPrice(amount);
//implicit coercion example
console.log(amount.toFixed(2));
//explicit coercion example
console.log(amount = "$" + String(amount.toFixed(2)));
*/
// NEW PROBLEM ------------------
/*
function one()
{
var a = 1;
console.log(a);
}
function two()
{
var a = 2;
console.log(a);
}
one();
two();
*/
// NEW PROBLEM -------------------
/*
const taxRate = 0.10;
const phone = 100.00;
const accLimit = 30.00;
const spendThres = 200.00;
var bankBal = 400.00;
var amount = 0;
function calcTax(amount)
{
return amount * taxRate;
}
function formatAmount(amount)
{
return "$" + amount.toFixed(2);
}
// keep buying phones while have money
while (amount < bankBal)
{
amount = amount + phone;
// can afford accessories
if(amount < spendThres)
{
amount = amount + accLimit;
}
}
// pay your taxes
amount = amount + calcTax(amount);
console.log("Your purchase was:" +formatAmount(amount));
if(calcTax(amount)+amount > bankBal)
{
console.log("You can't afford this purchase of:" +formatAmount(amount));
}
*/
// NEW PROBLEM ----------------
/*
var obj = {
a: "hey there",
b: 42,
c: true
};
console.log(obj.a, obj.b, obj.c);
console.log(obj["a"], obj["b"], obj["c"]);
*/
//NEW PROBLEM ------------------
/*
var a;
b = "hello world";
c = 13;
d = true;
e = null;
f = undefined;
console.log(typeof a, typeof b, typeof c, typeof d, typeof e, typeof f);
*/
// BTW - typeof null should return 'null' but returns 'object' -longstanding bug in JS
//NEW PROBLEM -----------------
//Arrays
/*
var array = [
"hello world",
13,
true
];
console.log(array[0],array[1], array[2]);
console.log(typeof array);
*/
//NEW PROBLEM ----------------
// Ternary Operator - ?
/*
let age = 19;
let oldEnoughToDrink = (age>=21 ? "drink up dude" : "wait til you're 21 dude");
console.log(oldEnoughToDrink);
*/
//NEW PROBLEM ----------------
/*
var a = 42;
var b = "foo";
console.log((typeof(a<b)));
*/
//NEW PROBLEM ---------------------------
// started using 'let' now instead of VAR, since that is older syntax
/*
function bern()
{
"use strict";
const a = 1;
if(a<= 1)
{
let b =2;
while(b< 5)
{
let c = b * 2;
b = b + 1;
console.log(a + c);
}
}
}
bern();
*/
//NEW PROBLEM -----------------------------
//SWITCH Statement example
/*
let expr = 6;
if(expr == 2)
{
console.log("hey, im 2");
}
else if (expr == 3)
{
console.log("hey, im 3");
}
else if (expr == 4)
{
console.log("hey, im 4");
}
else
{
console.log("outside the number range here");
}
*/
/*
let expressionA = 6;
'use strict';
switch(expressionA)
{
case 2:
console.log('hey, im 2');
break;
case 3:
console.log('hey, im 3');
break;
case 4:
console.log('hey, im 4');
break;
default:
console.log('hey, im bigger than 4');
break;
}
*/
//NEW PROBLEM -----------------------------
//Immediately Invoked funct expresns
/*
'use strict';
let a = 7;
(function bernImmd()
{
let b = 13;
console.log("hey, what's my lucky number? " + b);
}
)();
console.log("hey, its a number: " + a);
*/
//NEW PROBLEM ----------------------------
// THIS KEYWORD/IDENTIFIER
/*
let person = {
firstName: "bern",
lastName: "goll",
fullName: function()
{
return this.firstName + " "+ this.lastName;
}
};
console.log(person.fullName());
*/
//NEW PROBLEM ---------------------
/*
let myAge = 21;
console.log(Math.floor(myAge + 3.6));
//console.log(Math.ceil(myAge + 3.5));
console.log(Math.round(myAge + 3.5));
//console.log(Math.ceil(myAge + 3.5));
//console.log(Math.ceil(myAge + 3.5));
*/
//NEW PROBLEM ----------------
/*
let myArray = [3, 'bern', 'sophie',7, 5];
console.log('this is the largest number in array: '+(Math.max(myArray))); //this returns NaN error
*/
/*
let myNums = [ 3, 2 , 4, 7, 5];
console.log('this is the largest number in array: '+(Math.max.apply(Math, myNums))); //this returns ..in array: 5
*/
/*
let myNums = [ 3, 2 , 4, 7, 5];
console.log('this is the largest number in array: '+(Math.max.apply(Math, myNums)));
*/
/*
let myNums3 = (param1, param2) => { console.log(param1, param2) ;}
let myNumbs = (par1, par2) =>
{
console.log(par1, par2);
}
let myFunct = function(par1, par2)
{
console.log(par1, par2);
}
function abc(par1, par2)
{
console.log("these are the #",par1, par2);
}
let myObj= {
any: myFunct,
xyz: abc
};
myObj.xyz(5,7);
*/
/*
let myMin =[ 4,12,15,5];
console.log('this is smallest: ', Math.min.apply(Math, myMin));
*/
//NEW PROBLEM --------------
// Objects
/*
let myObj= {
any: function (a, b,)
{
let added =(a + b);
return added;
}
};
console.log( myObj.any(5,7) );
*/
// NEW PROBLEM ------------------------------------
// using APPLY function to CALL another function
/*
let myMin =[ 4, 12, 15, 5];
console.log('this is smallest #: ', Math.min.apply(Math, myMin));
*/
/*
// using the SPREAD function which is 3 dots to spread out the array so the Math function works- best descr
let mySmall = [13, 11, 16, 23];
console.log('smallest number: ', Math.min(...mySmall));
let myLarg = [13, 11, 16, 23, 2];
console.log('largest number is: ', Math.max(...myLarg));
*/
//NEW PROBLEM ----------------------------------------
// Practice Math Operation
/*
function multiply(num1, num2)
{
let product = num1 * num2;
return product;
}
(multiply(1,2)); //calls the multiply function and passes in numbers 1,2
(multiply(2,4)); // to see result add 'console.log()' in front of it
function add(num1, num2)
{
let added = num1 + num2;
return added;
}
console.log(add(13, (multiply(3,6)))); //outputs: 31 - which is Adding 13 to product of 3x6
*/
//NEW PROBLEM ----------------------
/*
let num = 3;
console.log(num); // 3
console.log(++num); // 4 print
console.log(num++); // print 5
console.log(num = num + 1); // 6 print
*/
//NEW PROBLEM ---------------
// showing Escape syntax so quotes or hypens work in a string
/*
console.log('how long we\'ve surfed is forever');
*/
//NEW PROBLEM ---------------------------------
// STRINGS TO NUMBERS AND NUMBERS TO STRINGS
/*
let myString = '123';
let myNum = Number(myString);
console.log(myNum); //output: 123
*/
/*
let myNum = 123;
let myString = myNum.toString();
console.log(myString); //output: 123
*/
//NEW PROBLEM ----------------
//String tools
/*
let longString = 'this is a super long string \
so i can go on and on over many lines in the editor \
or alternately adding the BACKSLACH character \
on each line.' ;
console.log(longString); //output: this whole long string printed out
*/
/*
let bernString = 'Just over the edge';
console.log('character at index 0 is '+ bernString.charAt(0));
// output: "character at index 0 is J"
*/
</script>
<script id="jsbin-source-javascript" type="text/javascript">// beginning JS exercises in JSBIN
/*
let a= 37;
let b= a * 2;
alert(b); // this is a pop up window
console.log(b); // this prints to the console screen
*/
// NEW PROBLEM -------------------
/*
let age = prompt('Please tell me your age:');
console.log(age);
*/
// NEW PROBLEM -------------------
/*
const taxRate = 0.07;
let amount = 99.99;
amount = amount * 2;
amount = amount + (amount * taxRate);
console.log(amount);
console.log(amount.toFixed (2));
*/
// NEW PROBLEM ------------------------------
// no arguement or parameter passed in here
//let amount = "99.99"; //throws an error since the 'toFixed' method looking for a number
//let amount = 99.99; // runs fine
/*
let amount = Number("99.99"); // runs fine; using explicit coercion so toFixed sees it as a number
printAmount();
function printAmount()
{
console.log( amount.toFixed(2));
}
*/
// NEW PROBLEM -----------------
/*
//function with arguement/parameter passed in
const taxRate = 0.10;
function calcFinalPrice(amt)
{
amt = amt + (amt * taxRate);
return amt;
}
var amount = 100.00;
amount = calcFinalPrice(amount);
//implicit coercion example
console.log(amount.toFixed(2));
//explicit coercion example
console.log(amount = "$" + String(amount.toFixed(2)));
*/
// NEW PROBLEM ------------------
/*
function one()
{
var a = 1;
console.log(a);
}
function two()
{
var a = 2;
console.log(a);
}
one();
two();
*/
// NEW PROBLEM -------------------
/*
const taxRate = 0.10;
const phone = 100.00;
const accLimit = 30.00;
const spendThres = 200.00;
var bankBal = 400.00;
var amount = 0;
function calcTax(amount)
{
return amount * taxRate;
}
function formatAmount(amount)
{
return "$" + amount.toFixed(2);
}
// keep buying phones while have money
while (amount < bankBal)
{
amount = amount + phone;
// can afford accessories
if(amount < spendThres)
{
amount = amount + accLimit;
}
}
// pay your taxes
amount = amount + calcTax(amount);
console.log("Your purchase was:" +formatAmount(amount));
if(calcTax(amount)+amount > bankBal)
{
console.log("You can't afford this purchase of:" +formatAmount(amount));
}
*/
// NEW PROBLEM ----------------
/*
var obj = {
a: "hey there",
b: 42,
c: true
};
console.log(obj.a, obj.b, obj.c);
console.log(obj["a"], obj["b"], obj["c"]);
*/
//NEW PROBLEM ------------------
/*
var a;
b = "hello world";
c = 13;
d = true;
e = null;
f = undefined;
console.log(typeof a, typeof b, typeof c, typeof d, typeof e, typeof f);
*/
// BTW - typeof null should return 'null' but returns 'object' -longstanding bug in JS
//NEW PROBLEM -----------------
//Arrays
/*
var array = [
"hello world",
13,
true
];
console.log(array[0],array[1], array[2]);
console.log(typeof array);
*/
//NEW PROBLEM ----------------
// Ternary Operator - ?
/*
let age = 19;
let oldEnoughToDrink = (age>=21 ? "drink up dude" : "wait til you're 21 dude");
console.log(oldEnoughToDrink);
*/
//NEW PROBLEM ----------------
/*
var a = 42;
var b = "foo";
console.log((typeof(a<b)));
*/
//NEW PROBLEM ---------------------------
// started using 'let' now instead of VAR, since that is older syntax
/*
function bern()
{
"use strict";
const a = 1;
if(a<= 1)
{
let b =2;
while(b< 5)
{
let c = b * 2;
b = b + 1;
console.log(a + c);
}
}
}
bern();
*/
//NEW PROBLEM -----------------------------
//SWITCH Statement example
/*
let expr = 6;
if(expr == 2)
{
console.log("hey, im 2");
}
else if (expr == 3)
{
console.log("hey, im 3");
}
else if (expr == 4)
{
console.log("hey, im 4");
}
else
{
console.log("outside the number range here");
}
*/
/*
let expressionA = 6;
'use strict';
switch(expressionA)
{
case 2:
console.log('hey, im 2');
break;
case 3:
console.log('hey, im 3');
break;
case 4:
console.log('hey, im 4');
break;
default:
console.log('hey, im bigger than 4');
break;
}
*/
//NEW PROBLEM -----------------------------
//Immediately Invoked funct expresns
/*
'use strict';
let a = 7;
(function bernImmd()
{
let b = 13;
console.log("hey, what's my lucky number? " + b);
}
)();
console.log("hey, its a number: " + a);
*/
//NEW PROBLEM ----------------------------
// THIS KEYWORD/IDENTIFIER
/*
let person = {
firstName: "bern",
lastName: "goll",
fullName: function()
{
return this.firstName + " "+ this.lastName;
}
};
console.log(person.fullName());
*/
//NEW PROBLEM ---------------------
/*
let myAge = 21;
console.log(Math.floor(myAge + 3.6));
//console.log(Math.ceil(myAge + 3.5));
console.log(Math.round(myAge + 3.5));
//console.log(Math.ceil(myAge + 3.5));
//console.log(Math.ceil(myAge + 3.5));
*/
//NEW PROBLEM ----------------
/*
let myArray = [3, 'bern', 'sophie',7, 5];
console.log('this is the largest number in array: '+(Math.max(myArray))); //this returns NaN error
*/
/*
let myNums = [ 3, 2 , 4, 7, 5];
console.log('this is the largest number in array: '+(Math.max.apply(Math, myNums))); //this returns ..in array: 5
*/
/*
let myNums = [ 3, 2 , 4, 7, 5];
console.log('this is the largest number in array: '+(Math.max.apply(Math, myNums)));
*/
/*
let myNums3 = (param1, param2) => { console.log(param1, param2) ;}
let myNumbs = (par1, par2) =>
{
console.log(par1, par2);
}
let myFunct = function(par1, par2)
{
console.log(par1, par2);
}
function abc(par1, par2)
{
console.log("these are the #",par1, par2);
}
let myObj= {
any: myFunct,
xyz: abc
};
myObj.xyz(5,7);
*/
/*
let myMin =[ 4,12,15,5];
console.log('this is smallest: ', Math.min.apply(Math, myMin));
*/
//NEW PROBLEM --------------
// Objects
/*
let myObj= {
any: function (a, b,)
{
let added =(a + b);
return added;
}
};
console.log( myObj.any(5,7) );
*/
// NEW PROBLEM ------------------------------------
// using APPLY function to CALL another function
/*
let myMin =[ 4, 12, 15, 5];
console.log('this is smallest #: ', Math.min.apply(Math, myMin));
*/
/*
// using the SPREAD function which is 3 dots to spread out the array so the Math function works- best descr
let mySmall = [13, 11, 16, 23];
console.log('smallest number: ', Math.min(...mySmall));
let myLarg = [13, 11, 16, 23, 2];
console.log('largest number is: ', Math.max(...myLarg));
*/
//NEW PROBLEM ----------------------------------------
// Practice Math Operation
/*
function multiply(num1, num2)
{
let product = num1 * num2;
return product;
}
(multiply(1,2)); //calls the multiply function and passes in numbers 1,2
(multiply(2,4)); // to see result add 'console.log()' in front of it
function add(num1, num2)
{
let added = num1 + num2;
return added;
}
console.log(add(13, (multiply(3,6)))); //outputs: 31 - which is Adding 13 to product of 3x6
*/
//NEW PROBLEM ----------------------
/*
let num = 3;
console.log(num); // 3
console.log(++num); // 4 print
console.log(num++); // print 5
console.log(num = num + 1); // 6 print
*/
//NEW PROBLEM ---------------
// showing Escape syntax so quotes or hypens work in a string
/*
console.log('how long we\'ve surfed is forever');
*/
//NEW PROBLEM ---------------------------------
// STRINGS TO NUMBERS AND NUMBERS TO STRINGS
/*
let myString = '123';
let myNum = Number(myString);
console.log(myNum); //output: 123
*/
/*
let myNum = 123;
let myString = myNum.toString();
console.log(myString); //output: 123
*/
//NEW PROBLEM ----------------
//String tools
/*
let longString = 'this is a super long string \
so i can go on and on over many lines in the editor \
or alternately adding the BACKSLACH character \
on each line.' ;
console.log(longString); //output: this whole long string printed out
*/
/*
let bernString = 'Just over the edge';
console.log('character at index 0 is '+ bernString.charAt(0));
// output: "character at index 0 is J"
*/
</script></body>
</html>
// beginning JS exercises in JSBIN
/*
let a= 37;
let b= a * 2;
alert(b); // this is a pop up window
console.log(b); // this prints to the console screen
*/
// NEW PROBLEM -------------------
/*
let age = prompt('Please tell me your age:');
console.log(age);
*/
// NEW PROBLEM -------------------
/*
const taxRate = 0.07;
let amount = 99.99;
amount = amount * 2;
amount = amount + (amount * taxRate);
console.log(amount);
console.log(amount.toFixed (2));
*/
// NEW PROBLEM ------------------------------
// no arguement or parameter passed in here
//let amount = "99.99"; //throws an error since the 'toFixed' method looking for a number
//let amount = 99.99; // runs fine
/*
let amount = Number("99.99"); // runs fine; using explicit coercion so toFixed sees it as a number
printAmount();
function printAmount()
{
console.log( amount.toFixed(2));
}
*/
// NEW PROBLEM -----------------
/*
//function with arguement/parameter passed in
const taxRate = 0.10;
function calcFinalPrice(amt)
{
amt = amt + (amt * taxRate);
return amt;
}
var amount = 100.00;
amount = calcFinalPrice(amount);
//implicit coercion example
console.log(amount.toFixed(2));
//explicit coercion example
console.log(amount = "$" + String(amount.toFixed(2)));
*/
// NEW PROBLEM ------------------
/*
function one()
{
var a = 1;
console.log(a);
}
function two()
{
var a = 2;
console.log(a);
}
one();
two();
*/
// NEW PROBLEM -------------------
/*
const taxRate = 0.10;
const phone = 100.00;
const accLimit = 30.00;
const spendThres = 200.00;
var bankBal = 400.00;
var amount = 0;
function calcTax(amount)
{
return amount * taxRate;
}
function formatAmount(amount)
{
return "$" + amount.toFixed(2);
}
// keep buying phones while have money
while (amount < bankBal)
{
amount = amount + phone;
// can afford accessories
if(amount < spendThres)
{
amount = amount + accLimit;
}
}
// pay your taxes
amount = amount + calcTax(amount);
console.log("Your purchase was:" +formatAmount(amount));
if(calcTax(amount)+amount > bankBal)
{
console.log("You can't afford this purchase of:" +formatAmount(amount));
}
*/
// NEW PROBLEM ----------------
/*
var obj = {
a: "hey there",
b: 42,
c: true
};
console.log(obj.a, obj.b, obj.c);
console.log(obj["a"], obj["b"], obj["c"]);
*/
//NEW PROBLEM ------------------
/*
var a;
b = "hello world";
c = 13;
d = true;
e = null;
f = undefined;
console.log(typeof a, typeof b, typeof c, typeof d, typeof e, typeof f);
*/
// BTW - typeof null should return 'null' but returns 'object' -longstanding bug in JS
//NEW PROBLEM -----------------
//Arrays
/*
var array = [
"hello world",
13,
true
];
console.log(array[0],array[1], array[2]);
console.log(typeof array);
*/
//NEW PROBLEM ----------------
// Ternary Operator - ?
/*
let age = 19;
let oldEnoughToDrink = (age>=21 ? "drink up dude" : "wait til you're 21 dude");
console.log(oldEnoughToDrink);
*/
//NEW PROBLEM ----------------
/*
var a = 42;
var b = "foo";
console.log((typeof(a<b)));
*/
//NEW PROBLEM ---------------------------
// started using 'let' now instead of VAR, since that is older syntax
/*
function bern()
{
"use strict";
const a = 1;
if(a<= 1)
{
let b =2;
while(b< 5)
{
let c = b * 2;
b = b + 1;
console.log(a + c);
}
}
}
bern();
*/
//NEW PROBLEM -----------------------------
//SWITCH Statement example
/*
let expr = 6;
if(expr == 2)
{
console.log("hey, im 2");
}
else if (expr == 3)
{
console.log("hey, im 3");
}
else if (expr == 4)
{
console.log("hey, im 4");
}
else
{
console.log("outside the number range here");
}
*/
/*
let expressionA = 6;
'use strict';
switch(expressionA)
{
case 2:
console.log('hey, im 2');
break;
case 3:
console.log('hey, im 3');
break;
case 4:
console.log('hey, im 4');
break;
default:
console.log('hey, im bigger than 4');
break;
}
*/
//NEW PROBLEM -----------------------------
//Immediately Invoked funct expresns
/*
'use strict';
let a = 7;
(function bernImmd()
{
let b = 13;
console.log("hey, what's my lucky number? " + b);
}
)();
console.log("hey, its a number: " + a);
*/
//NEW PROBLEM ----------------------------
// THIS KEYWORD/IDENTIFIER
/*
let person = {
firstName: "bern",
lastName: "goll",
fullName: function()
{
return this.firstName + " "+ this.lastName;
}
};
console.log(person.fullName());
*/
//NEW PROBLEM ---------------------
/*
let myAge = 21;
console.log(Math.floor(myAge + 3.6));
//console.log(Math.ceil(myAge + 3.5));
console.log(Math.round(myAge + 3.5));
//console.log(Math.ceil(myAge + 3.5));
//console.log(Math.ceil(myAge + 3.5));
*/
//NEW PROBLEM ----------------
/*
let myArray = [3, 'bern', 'sophie',7, 5];
console.log('this is the largest number in array: '+(Math.max(myArray))); //this returns NaN error
*/
/*
let myNums = [ 3, 2 , 4, 7, 5];
console.log('this is the largest number in array: '+(Math.max.apply(Math, myNums))); //this returns ..in array: 5
*/
/*
let myNums = [ 3, 2 , 4, 7, 5];
console.log('this is the largest number in array: '+(Math.max.apply(Math, myNums)));
*/
/*
let myNums3 = (param1, param2) => { console.log(param1, param2) ;}
let myNumbs = (par1, par2) =>
{
console.log(par1, par2);
}
let myFunct = function(par1, par2)
{
console.log(par1, par2);
}
function abc(par1, par2)
{
console.log("these are the #",par1, par2);
}
let myObj= {
any: myFunct,
xyz: abc
};
myObj.xyz(5,7);
*/
/*
let myMin =[ 4,12,15,5];
console.log('this is smallest: ', Math.min.apply(Math, myMin));
*/
//NEW PROBLEM --------------
// Objects
/*
let myObj= {
any: function (a, b,)
{
let added =(a + b);
return added;
}
};
console.log( myObj.any(5,7) );
*/
// NEW PROBLEM ------------------------------------
// using APPLY function to CALL another function
/*
let myMin =[ 4, 12, 15, 5];
console.log('this is smallest #: ', Math.min.apply(Math, myMin));
*/
/*
// using the SPREAD function which is 3 dots to spread out the array so the Math function works- best descr
let mySmall = [13, 11, 16, 23];
console.log('smallest number: ', Math.min(...mySmall));
let myLarg = [13, 11, 16, 23, 2];
console.log('largest number is: ', Math.max(...myLarg));
*/
//NEW PROBLEM ----------------------------------------
// Practice Math Operation
/*
function multiply(num1, num2)
{
let product = num1 * num2;
return product;
}
(multiply(1,2)); //calls the multiply function and passes in numbers 1,2
(multiply(2,4)); // to see result add 'console.log()' in front of it
function add(num1, num2)
{
let added = num1 + num2;
return added;
}
console.log(add(13, (multiply(3,6)))); //outputs: 31 - which is Adding 13 to product of 3x6
*/
//NEW PROBLEM ----------------------
/*
let num = 3;
console.log(num); // 3
console.log(++num); // 4 print
console.log(num++); // print 5
console.log(num = num + 1); // 6 print
*/
//NEW PROBLEM ---------------
// showing Escape syntax so quotes or hypens work in a string
/*
console.log('how long we\'ve surfed is forever');
*/
//NEW PROBLEM ---------------------------------
// STRINGS TO NUMBERS AND NUMBERS TO STRINGS
/*
let myString = '123';
let myNum = Number(myString);
console.log(myNum); //output: 123
*/
/*
let myNum = 123;
let myString = myNum.toString();
console.log(myString); //output: 123
*/
//NEW PROBLEM ----------------
//String tools
/*
let longString = 'this is a super long string \
so i can go on and on over many lines in the editor \
or alternately adding the BACKSLACH character \
on each line.' ;
console.log(longString); //output: this whole long string printed out
*/
/*
let bernString = 'Just over the edge';
console.log('character at index 0 is '+ bernString.charAt(0));
// output: "character at index 0 is J"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment