Issue
I was reading a blog article about Puppeteer(A Node Library that helps with browser automation) in which it said the following,
"You can append one or more arguments to page.evaluate since it's variadic in what it accepts."
What quality about a function makes it 'variadic'?
Solution
A variadic function is a function where the total number of parameters are unknown and can be adjusted at the time the method is called.
Basically if the number of parameters are unknown then it's variadic.
It can be done using rest parameters, any number of parameters can be passed. Below, myFunction can have any number of parameters.
myFunction(...iterableObj)
Same also applies for console.log(), you can pass any number of parameters in it which makes it variadic.
Talking about Page.evaluate in specific, from its documentation, it also accepts rest parameters making it variadic.
The second parameter args is a rest parameter.
Answered By - Neon Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.