Skip to content

Instantly share code, notes, and snippets.

@04wakeup
Created June 2, 2020 03:07
Show Gist options
  • Select an option

  • Save 04wakeup/7344b7098ae302f0f63cf324b78547c1 to your computer and use it in GitHub Desktop.

Select an option

Save 04wakeup/7344b7098ae302f0f63cf324b78547c1 to your computer and use it in GitHub Desktop.
ES6 in Action: New String Methods ES6 in Action: New String Methods [3] // source https://jsbin.com/tusijey
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="ES6 in Action: New String Methods [3]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>ES6 in Action: New String Methods</title>
<style id="jsbin-css">
.money
{
color:red;
}
.moneyLost
{
color:yellow;
}
.moneyFinal
{
color:blue;
}
</style>
</head>
<body>
<h1> This is javascript</h1>
<h2 id = "change" class="money">Money you have</h2>
<button style="button" onclick="myAwesomFunction()">Call Me</button><br><br>
<h2 id = "headerChange" class="moneyLost">Money you owe</h2>
<h2 id = "result" class="moneyFinal">Money you have left</h2>
<button style="button" onclick="myAwesomeFunction2()">Call Me 2</button><br><br>
<script>
var number = 10;
var otherNumber = 12;
var names = "James";
var onOff = true;
var a = 1, b= 2, c = 3, d = 4;
a = 40;
function myAwesomFunction()
{
a = a + 1;
b = b - 1;
document.getElementById("change").innerHTML= "This is how much money you have: $" + a;
document.getElementById("headerChange").innerHTML= "This is how much money you owe: $" + b;
document.getElementById("result").innerHTML= "This is how much money you have left: $" + (a - b);
}
function myAwesomeFunction2(){
a = 50;
b = 100;
}
</script>
<script id="jsbin-javascript">
'use strict';
var str = 'Hello everybody, my name is Aurelio De Rosa.';
var result = str.includes('Aurelio');
console.log(result);
result = str.includes('Hello', 10);
console.log(result);
</script>
<script id="jsbin-source-css" type="text/css">.money
{
color:red;
}
.moneyLost
{
color:yellow;
}
.moneyFinal
{
color:blue;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">const str = 'Hello everybody, my name is Aurelio De Rosa.';
let result = str.includes('Aurelio');
console.log(result);
result = str.includes('Hello', 10);
console.log(result);</script></body>
</html>
.money
{
color:red;
}
.moneyLost
{
color:yellow;
}
.moneyFinal
{
color:blue;
}
'use strict';
var str = 'Hello everybody, my name is Aurelio De Rosa.';
var result = str.includes('Aurelio');
console.log(result);
result = str.includes('Hello', 10);
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment