xxxxxxxxxx
//Use a constructor-like function to initialize a map found inside a struct
//Struch with map inside
type Graph struct {
connections map[Vertex][]Vertex
}
//Constructor function
func NewGraph() *Graph {
var g Graph
g.connections = make(map[Vertex][]Vertex)
return &g
}
//Declare and initialize the struct instance with the constructor
func main(){
graph := NewGraph()
}
xxxxxxxxxx
// By default maps in Go behaves like a default dictionary in python
m := make(map[string]int)
m["Dio"] = 3
m["Jonathan"] = 1
xxxxxxxxxx
// This is JQuery syntax for adding a task card to a task board
<script>
$(document).ready(function(){
$(".add-card").on("click", function(){
var description = $(".new-card-task").val();
var today = new Date();
var dateStr = (today.getMonth()+1) + "/" + today.getDate() + "/" + today.getFullYear();
var newCard = $(`<div class="card"><div class="rectangle yellow"></div><div class="rectangle green"></div><div class="rectangle blue"></div><div class="rectangle orange"></div><p class="task-description">${description}</p><img class="list-icon" src="https://content.codecademy.com/courses/learn-css-grid/project-ii/Resources/list_icon.svg"><p class="task-date">${dateStr}</p></div>`)
$(".add-card-container").before(newCard);
})
})
</script>