This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For each of the following code fragments: | |
// a. what does the code do? | |
// b. what did the author intend for it to do? | |
// c. how would you fix it? | |
// NOTE: all code samples work exactly the same in all browsers | |
// 1. object literals | |
var data = [ { high: 100, low: 81 }, { high: 93, low: 73 }, { high: 60, low: 32 } ]; | |
function getAverages(data) { | |
var avgs = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ChangeEntry struct { | |
Namespace string | |
Type string // insert, update, or delete | |
ID string // the unique identifier of the object | |
Object map[string]interface{} // There are limitations on this object... | |
} | |
func convertOp(op map[string]interface{}) (*ChangeEntry, error) { | |
// Note that this has only been tested for the Mongo 2.4 format |