Returns a string by concatenating all of the elements in the collection, separated by the specified separator string.

Use reflect.ValueOf() to get the array or slice and the separator string, make() to create an appropriate string slice.
Use a for loop with Value.Len() and Value.Index() to iterate over each element, fmt.Sprintf() to convert it to a string.
Use strings.Join() to combine the strings using the separator provided.

继续阅读 30秒学会 Golang 片段 – Join

Add special characters to text to print in color in the console (combined with console.log()).

Use template literals and special characters to add the appropriate color code to the string output.
For background colors, add a special character that resets the background color at the end of the string.

继续阅读 30秒学会 JavaScript 片段 – colorize

Encode a set of form elements as a query string.

Use the FormData constructor to convert the HTML form to FormData, Array.from() to convert to an array, passing a map function as the second argument.
Use and window.encodeURIComponent() to encode each field’s value.
Use Array.prototype.join() with appropriate argumens to produce an appropriate query string.

继续阅读 30秒学会 JavaScript 片段 – serializeForm