Published
Edited
Feb 16, 2019
Insert cell
Insert cell
Insert cell
Insert cell
// Your code here

Insert cell
Insert cell
array1=['I', 'am', 'learning','Javascript','to','munge','large','datasets','and','visualize','them']
Insert cell
Insert cell
function m_copy(source)
{
var target={}
var ss=source.join(" ")
target=ss.split(" ")
return target
}
Insert cell
{
var array2=m_copy(array1)
return array2.join(" ")
}

Insert cell
{
var array3=m_copy(array1)
return array3.reverse()
}
Insert cell
{
var array4=m_copy(array1)
return array4.sort()
}
Insert cell
{
var array5=m_copy(array1)
return array5.sort(function(a,b){
return a.toLowerCase().localeCompare(b.toLowerCase());
})
}
Insert cell
Insert cell
html`
<ul>
<li style="background:red">red</li>
<li style="background:green">green</li>
<li style="background:purple">purple</li>
<li style="background:blue">blue</li>
<li style="background:pink">pink</li>
</ul>
`

Insert cell
Insert cell
md`
The current time is: *(**${new Date(now)}**)*
`

Insert cell
// Your code here

Insert cell
Insert cell
Insert cell
function getPlace()
{
var fav=[ place("Beijing","The Great Wall","40","30","China"),
place("Beijing","The Great Wall","40","30","China"),
place("Beijing","The Great Wall","40","30","China"),
place("Beijing","The Great Wall","40","30","China"),
place("Beijing","The Great Wall","40","30","China")]
var obj=new Object()
obj.array=fav
return obj
}
Insert cell
Insert cell
function toUpper(Loc1,Loc2)
{
this.array[0].location=Loc1
this.array[1].location=Loc2
}
Insert cell
{
var obj=getPlace()
obj.toUpper=toUpper
obj.toUpper(obj.array[0].location.toUpperCase(),obj.array[1].location.toUpperCase())
return obj
}
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