define prototype code example
Example 1: function prototype
// function prototype
void add(int, int);
int main() {
// calling the function before declaration.
add(5, 3);
return 0;
}
// function definition
void add(int a, int b) {
cout << (a + b);
}
Example 2: prototype
String.prototype.countCharacter = function(char) {
return [...this].filter(c => c === char).length;
}