js 7*45You can see that the keyword is invoked by typing the command js and the argument 7*45, separated by a space. You need to specify the following data to create a keyword:
- Keyword: the command used to invoke the keyword. For the calculator keyword this value is, obviously, js.
- URL: the URL that defines what the keyword does. Usually, this URL has a place holder %s where the argument is to be filled in. For example, you could define a keyword for a Google search via the URL
http://www.google.com/#q=%sIf a keyword does not need an argument then you omit the %s.
Creating the calculator keyword in Google ChromeGo to “Preferences → Basics → Search → Manage Search Engines...” and create a new entry:
- Keyword: js
- Execute the menu command “Bookmarks → Show All Bookmarks”. Then use the menu with the sprocket symbol to perform “New Bookmark...”.
- Alternatively, “New Bookmark...” is also available via a the context menu (=right-click) of the bookmarks toolbar.
- Enter the data:
- Keyword: js
- Arithmetic operators: addition (+), subtraction (-), multiplication (*), division (/), modulo (%).
77 / 11 → 7 3.16 * 5 → 15.8 10 % 7 → 3
- Properties and methods of the global object Math :
- Math.pow(base, exponent)
- Converting to and from hexadecimal, binary, etc.
(255).toString(16) → 'ff' parseInt("ff", 16) → 255You need to put an integer in parenthesis to invoke a method on it. Otherwise the dot will be mistaken for a decimal point. Alternatively, you can type two dots or append .0.