Published
Edited
Aug 28, 2019
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myString[5]
Insert cell
Insert cell
Insert cell
Insert cell
myString[300]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myString.length
Insert cell
Insert cell
myString[myString.length]
Insert cell
Insert cell
myString[myString.length - 1]
Insert cell
Insert cell
myString.toUpperCase()
Insert cell
myString.toLowerCase()
Insert cell
Insert cell
"I am a string".toUpperCase();
Insert cell
Insert cell
" I typed a lot of spaces ".trim()
Insert cell
Insert cell
myString.slice(0, 5)
Insert cell
"Hi".slice(0,5)
Insert cell
Insert cell
myString.slice(0,-1)
Insert cell
Insert cell
"Am I a question?".endsWith('?');
Insert cell
Insert cell
myString.includes('Hello')
Insert cell
Insert cell
myString.split(',')
Insert cell
myString.split('')
Insert cell
Insert cell
"Hello, World".replace("Hello", "Goodbye")
Insert cell
Insert cell
"Hello, World. It is nice to say Hello.".replace("Hello","Goodbye")
Insert cell
Insert cell
"Hello, World. It is nice to say Hello.".replace(/Hello/g,"Goodbye")
Insert cell
Insert cell
Insert cell
"Hello, " + "World"
Insert cell
Insert cell
{
let string1 = "Hello"
let string2 = "World"
return string1 + ", " + string2
}
Insert cell
Insert cell
"This is some " + "big text".toUpperCase()
Insert cell
Insert cell
"This is some " + "spaced out text".toUpperCase().split('').join(' ')
Insert cell
Insert cell
Insert cell
Insert cell
disguisedEmail = {
if ( !email.match(/.*@.*\..*/g) ){
return 'Input is not an email address';
}
let username = email.slice( 0, email.indexOf('@') );
let domain = email.slice( email.indexOf('@')+1, email.indexOf('.') );
let tld = email.slice( email.indexOf('.')+1, email.length );
function hide(input){
return input.slice(0,1).padEnd(input.length-1, '*') + input[input.length-1];
}
return hide(username)
+ '@'
+ hide(domain)
+ '.'
+ tld;
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more