Published
Edited
Feb 18, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myArray.push('LaStTeXtSTyLe');
Insert cell
myArray
Insert cell
Insert cell
myArray[4] = "NEW"
Insert cell
myArray[4]
Insert cell
Insert cell
array1=['I', 'am', 'learning','Javascript','to','munge','large','datasets','and','visualize','them']
Insert cell
Insert cell
// Your code here
normal_sentence = array1.join(' ')
Insert cell
reverse_order = array1.reverse();
Insert cell
default_order = array1.sort()
Insert cell
case_insensitive = array1.sort(function (a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase());
});
Insert cell
reverse_alpha = case_insensitive.reverse();
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html`<button id="submit_pw" onclick="">Submit Your Password</button>`

// So, the pseudo code here is fail_count = 0, and the function (test_pw()) has and if/else for testing the password (regex, probably) and then a fail state, incrementing the fail counter by 1. The problem I'm hitting (and why I gave up the hubris of doing this older version of the exersize, is that I'm having trouble defining a global variable count (fail_count) that would then be incremented by test_pw() as the function is run.
Insert cell
Insert cell
// Your code here
favorite = {
const my_places = {"places":[
{"location":"Europe", "name":"Lisboa", "latitude":"38°42′50″ N", "longitude":"9°8′22″W", "country":"Portugal"},
{"location":"South America", "name":"Goiás", "latitude":"15°56′S", "longitude":"50°8′W", "country":"Brazil"},
{"location":"North America", "name":"Memphis", "latitude":"35°07′03″N", "longitude":"89°58′16″W", "country":"USA"},
{"location":"Asia", "name":"Osaka (大阪市)", "latitude":"34°41′38″N", "longitude":" 135°30′8″E", "country":"Japan"},
{"location":"Australia", "name":"Perth", "latitude":"31°57′8″S", "longitude":"115°51′32″E", "country":"Australia"}
]}
return my_places
}
Insert cell
Insert cell
// Your code here
function make_em_uppercase(a,b) {
for (let i=a ; i<=b ; ++i){ // range agnostic
favorite.places[i].name = favorite.places[i].name.toUpperCase();
}
return favorite.places[a].name + ' & ' + favorite.places[b].name; // or whichver entries you want. on this you could do another for loop and log each
}

Insert cell
make_em_uppercase(0,1)
Insert cell
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