Creating a custom function — concatBytes

Report a typo

Suppose you want to create the concatBytes function, which is very similar to the concatRunes function you've previously seen in the theory.

Please modify the concat function template below so the function is called concatBytes and properly uses the WriteByte() method within it.

Sample Input 1:

Sample Output 1:

JBAcademy
Write a program in Go
package main

import (
"fmt"
"strings"
)

// Modify the concat function template below to properly implement the concatBytes function
func concat?(bytes ...byte) string {
var builder strings.Builder
for _, x := range bytes {
builder.Write?(x)
}
return builder.String()
}

func main() {
fmt.Println(concatBytes('J', 'B', 'A', 'c', 'a', 'd', 'e', 'm', 'y'))
}
___

Create a free account to access the full topic