Created
February 19, 2019 19:32
-
-
Save melissamcewen/e2b98f7469fc325227940d31ffc7fab8 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/gadojes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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"> | |
"use strict"; | |
var text = ""; | |
var emojified = []; | |
var emoji = "🌽"; | |
var sign = "Go Gators!"; | |
// ok so let's get a word count | |
var wordCount = sign.split(" ").length; | |
console.log(wordCount + " is the word count"); | |
// divide the word count in two for words per line | |
var wordsPerLine = wordCount / 2; | |
console.log(wordsPerLine + "there will be words per line "); | |
// make an array of the words | |
var words = sign.split(" "); | |
// slice it up into two lines | |
var line1 = words.slice(0, wordsPerLine); | |
var line1Text = ""; | |
line1.forEach(function (element) { | |
line1Text += element; | |
}); | |
var line2 = words.slice(wordsPerLine); | |
var line2Text = ""; | |
line2.forEach(function (element) { | |
line2Text += element; | |
}); | |
//add padding | |
line1Text = " " + line1Text + " "; | |
line2Text = " " + line2Text + " "; | |
console.log("Line 1 will be " + line1Text); | |
console.log("Line 1 will be " + line2Text); | |
lineLength = line2Text.length; | |
console.log("Line length for our sign is " + lineLength); | |
//top time to make the top of the sign | |
var signBorder = "_"; | |
//top is just as long as the length of our text | |
var signTop = " " + signBorder.repeat(lineLength) + " "; | |
console.log("here is the sign top"); | |
console.log(signTop); | |
//sign botom has pipes on the edges | |
var signBottom = "|" + signBorder.repeat(lineLength) + "|"; | |
console.log("here is the sign bottom"); | |
console.log(signBottom); | |
emojified.push("driving through california is like \n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| _________________ \n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | HELL |\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | IS REAL. |\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| |_________________|\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | | \n"); | |
emojified.forEach(function (element) { | |
text += element; | |
//console.log(element.length); | |
}); | |
//console.log(text) | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> let text = ""; | |
let emojified = []; | |
let emoji = "🌽"; | |
let sign = "Go Gators!" | |
// ok so let's get a word count | |
let wordCount = sign.split(" ").length; | |
console.log(wordCount + " is the word count") | |
// divide the word count in two for words per line | |
let wordsPerLine = wordCount / 2; | |
console.log(wordsPerLine + "there will be words per line ") | |
// make an array of the words | |
let words = sign.split(" "); | |
// slice it up into two lines | |
let line1 = words.slice(0, wordsPerLine); | |
let line1Text = ""; | |
line1.forEach(function(element) { | |
line1Text += element; | |
}); | |
let line2 = words.slice(wordsPerLine); | |
let line2Text = ""; | |
line2.forEach(function(element) { | |
line2Text += element; | |
}); | |
//add padding | |
line1Text = " " + line1Text + " "; | |
line2Text = " " + line2Text + " "; | |
console.log("Line 1 will be " + line1Text); | |
console.log("Line 1 will be " + line2Text); | |
lineLength = line2Text.length; | |
console.log("Line length for our sign is " + lineLength); | |
//top time to make the top of the sign | |
let signBorder = "_"; | |
//top is just as long as the length of our text | |
let signTop = " " + signBorder.repeat(lineLength) + " "; | |
console.log("here is the sign top"); | |
console.log(signTop); | |
//sign botom has pipes on the edges | |
let signBottom = "|" + signBorder.repeat(lineLength) + "|"; | |
console.log("here is the sign bottom"); | |
console.log(signBottom); | |
emojified.push("driving through california is like \n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| _________________ \n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | HELL |\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | IS REAL. |\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| |_________________|\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | | \n"); | |
emojified.forEach(function(element) { | |
text += element; | |
//console.log(element.length); | |
}); | |
//console.log(text)</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var text = ""; | |
var emojified = []; | |
var emoji = "🌽"; | |
var sign = "Go Gators!"; | |
// ok so let's get a word count | |
var wordCount = sign.split(" ").length; | |
console.log(wordCount + " is the word count"); | |
// divide the word count in two for words per line | |
var wordsPerLine = wordCount / 2; | |
console.log(wordsPerLine + "there will be words per line "); | |
// make an array of the words | |
var words = sign.split(" "); | |
// slice it up into two lines | |
var line1 = words.slice(0, wordsPerLine); | |
var line1Text = ""; | |
line1.forEach(function (element) { | |
line1Text += element; | |
}); | |
var line2 = words.slice(wordsPerLine); | |
var line2Text = ""; | |
line2.forEach(function (element) { | |
line2Text += element; | |
}); | |
//add padding | |
line1Text = " " + line1Text + " "; | |
line2Text = " " + line2Text + " "; | |
console.log("Line 1 will be " + line1Text); | |
console.log("Line 1 will be " + line2Text); | |
lineLength = line2Text.length; | |
console.log("Line length for our sign is " + lineLength); | |
//top time to make the top of the sign | |
var signBorder = "_"; | |
//top is just as long as the length of our text | |
var signTop = " " + signBorder.repeat(lineLength) + " "; | |
console.log("here is the sign top"); | |
console.log(signTop); | |
//sign botom has pipes on the edges | |
var signBottom = "|" + signBorder.repeat(lineLength) + "|"; | |
console.log("here is the sign bottom"); | |
console.log(signBottom); | |
emojified.push("driving through california is like \n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| _________________ \n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | HELL |\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | IS REAL. |\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| |_________________|\n"); | |
emojified.push(emoji + "|⬜️⬜️||⬜️⬜️| | | \n"); | |
emojified.forEach(function (element) { | |
text += element; | |
//console.log(element.length); | |
}); | |
//console.log(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment