Ruby noob
Ruby noob

Reputation: 507

What does %(jscode)s in javascript mean?

The only use I can find for % in any javascript documentation is modulo division. I don't understand what this line of code does:

%(jscode)s

Source is line 13 of this:

https://code.google.com/apis/visualization/documentation/dev/gviz_api_lib.html#exampleusage

Upvotes: 0

Views: 262

Answers (2)

Ben Blank
Ben Blank

Reputation: 56604

That isn't actually Javascript, it's Python string formatting.

The file you link is a Python file and, when it's executed, additional Javascript code is inserted into it before it's sent to the browser. %(jscode)s simply acts as the insertion point for that dynamic code. You can see another insertion point — %(json)s — on line 18, the definition of jscode on line 46, and the actual formatting / interpolation on line 56.

Upvotes: 2

AlG
AlG

Reputation: 15157

It's not javascript, that's a python replacement in the python script.

Upvotes: 0

Related Questions