Skip to content

Instantly share code, notes, and snippets.

@hillbilly300
Created October 27, 2019 18:35
Show Gist options
  • Save hillbilly300/f3ef520f408b969b5b445156725c5203 to your computer and use it in GitHub Desktop.
Save hillbilly300/f3ef520f408b969b5b445156725c5203 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/zomemib
<!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">
//jshint esnext:true
let string1 = "The quick brown fox jumps over the lazy dog.?"
let string2 = "If the dog reacted, was it really lazy"
// accessing string chars
// charAt,charCodeAt
console.log(string1.charAt(1))
console.log(string1.charCodeAt(1))
//searching
//includes,match
console.log(string1.match(/[A-z]/gi))
console.log(string1.includes('qu'))
console.log(string2.endsWith('was it really lazy'))
// manipulate
// replace,split
console.log(string1.replace(/s/,''))
console.log(string1.replace('fox','goat'))
console.log(string1.split(' '))
// formatting
// toLowerCase, toUpperCase, trim
</script>
<script id="jsbin-source-javascript" type="text/javascript">//jshint esnext:true
let string1 = "The quick brown fox jumps over the lazy dog.?"
let string2 = "If the dog reacted, was it really lazy"
// accessing string chars
// charAt,charCodeAt
console.log(string1.charAt(1))
console.log(string1.charCodeAt(1))
//searching
//includes,match
console.log(string1.match(/[A-z]/gi))
console.log(string1.includes('qu'))
console.log(string2.endsWith('was it really lazy'))
// manipulate
// replace,split
console.log(string1.replace(/s/,''))
console.log(string1.replace('fox','goat'))
console.log(string1.split(' '))
// formatting
// toLowerCase, toUpperCase, trim</script></body>
</html>
//jshint esnext:true
let string1 = "The quick brown fox jumps over the lazy dog.?"
let string2 = "If the dog reacted, was it really lazy"
// accessing string chars
// charAt,charCodeAt
console.log(string1.charAt(1))
console.log(string1.charCodeAt(1))
//searching
//includes,match
console.log(string1.match(/[A-z]/gi))
console.log(string1.includes('qu'))
console.log(string2.endsWith('was it really lazy'))
// manipulate
// replace,split
console.log(string1.replace(/s/,''))
console.log(string1.replace('fox','goat'))
console.log(string1.split(' '))
// formatting
// toLowerCase, toUpperCase, trim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment