Skip to content

Instantly share code, notes, and snippets.

@abhishek-buragadda
abhishek-buragadda / gist:a65a6bfc86c0f3c22e031b6571580c1d
Created December 15, 2022 05:03
GET/SET a struct field by name in golang
package main
import (
"fmt"
"reflect"
)
type Test struct {
One string
Two string
************nil in golang*******************
- nil == nil // true .
The above statement is straight forward.
But suppose there is a pointer of a struct whose value is nil.
```
@abhishek-buragadda
abhishek-buragadda / nativeJavaScript.js
Created February 5, 2018 12:38 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests