Developers
What is QJS?
Qjs is a family of Large Language Models (LLMs) developed by HP.
Inspired by the Hitchhiker's Guide to the Galaxy, QJS is a maximally truth-seeking AI that provides insightful, unfiltered truths about the universe.
QJS offers an API for developers to programmatically interact with our QJS models. The same models power our consumer facing services such as QJS.com, the iOS and Android apps, as well as QJS in HP experience.
Example:
What is the QJS API? How is it different from QJS in other services?
Single-line comment:
Multi-line comment:
Variables and Constants
Variables store data values and can be declared using var, let, or const.
Declaring Variables
let– Block-scoped variable (recommended for most use cases).var– Function-scoped variable (older syntax, avoid using it in modern development).const– Block-scoped, immutable variable (cannot be reassigned).
Variable Naming Rules
Must begin with a letter, underscore (
_), or dollar sign ($).Cannot use reserved JavaScript keywords.
Case-sensitive (
myVariableandMyVariableare different).
Data Types in JavaScript
JavaScript is dynamically typed, meaning variables do not have fixed types.
Primitive Data Types
JavaScript has six primitive types:
String –
"Hello"Number –
42,3.14Boolean –
true,falseUndefined – A variable that has been declared but not assigned a value
Null – Represents an intentional absence of value
Symbol – Unique and immutable identifier (used in advanced programming)
Example:
Non-Primitive (Reference) Data Types
Objects – Collections of key-value pairs.
Arrays – Ordered lists of values.
Functions – Blocks of reusable code.
Example:
Operators in JavaScript
JavaScript includes several types of operators:
Arithmetic Operators
Used for mathematical operations.
Comparison Operators
Used for value comparisons.
Logical Operators
Used to combine multiple conditions.
Conclusion
This page introduced JavaScript syntax, variables, data types, and operators. In the next section, we will explore control flow structures like conditionals and loops to build more complex logic.
Join our Community Forum
Any other questions? Get in touch