<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "JavaScriptCore",
  "identifier" : "/documentation/JavaScriptCore/JSValueRef",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@T@JSValueRef"
  },
  "title" : "JSValueRef"
}
-->

# JSValueRef

A JavaScript value.

```
typealias JSValueRef = OpaquePointer
```

## Discussion

This is the base type for all JavaScript values, and polymorphic functions on them.

## Topics

### Testing the Value’s Type

[`JSValueGetType(_:_:)`](/documentation/JavaScriptCore/JSValueGetType(_:_:))

Returns a JavaScript value’s type.

[`JSValueIsUndefined(_:_:)`](/documentation/JavaScriptCore/JSValueIsUndefined(_:_:))

Tests whether a JavaScript value’s type is the undefined type.

[`JSValueIsNull(_:_:)`](/documentation/JavaScriptCore/JSValueIsNull(_:_:))

Tests whether a JavaScript value’s type is the null type.

[`JSValueIsBoolean(_:_:)`](/documentation/JavaScriptCore/JSValueIsBoolean(_:_:))

Tests whether a JavaScript value is Boolean.

[`JSValueIsNumber(_:_:)`](/documentation/JavaScriptCore/JSValueIsNumber(_:_:))

Tests whether a JavaScript value’s type is the number type.

[`JSValueIsString(_:_:)`](/documentation/JavaScriptCore/JSValueIsString(_:_:))

Tests whether a JavaScript value’s type is the string type.

[`JSValueIsSymbol(_:_:)`](/documentation/JavaScriptCore/JSValueIsSymbol(_:_:))

Tests whether a JavaScript value’s type is the symbol type.

[`JSValueIsObject(_:_:)`](/documentation/JavaScriptCore/JSValueIsObject(_:_:))

Tests whether a JavaScript value’s type is the object type.

[`JSValueIsObjectOfClass(_:_:_:)`](/documentation/JavaScriptCore/JSValueIsObjectOfClass(_:_:_:))

Tests whether a JavaScript value is an object with a specified class in its class chain.

[`JSValueIsArray(_:_:)`](/documentation/JavaScriptCore/JSValueIsArray(_:_:))

Tests whether a JavaScript value is an array.

[`JSValueIsDate(_:_:)`](/documentation/JavaScriptCore/JSValueIsDate(_:_:))

Tests whether a JavaScript value is a date.

[`JSValueGetTypedArrayType(_:_:_:)`](/documentation/JavaScriptCore/JSValueGetTypedArrayType(_:_:_:))

Returns a JavaScript value’s typed array type.

[`JSType`](/documentation/JavaScriptCore/JSType)

Constants that identify the type of a JavaScript value.

### Creating Values

[`JSValueMakeUndefined(_:)`](/documentation/JavaScriptCore/JSValueMakeUndefined(_:))

Creates a JavaScript value of the undefined type.

[`JSValueMakeNull(_:)`](/documentation/JavaScriptCore/JSValueMakeNull(_:))

Creates a JavaScript value of the null type.

[`JSValueMakeBoolean(_:_:)`](/documentation/JavaScriptCore/JSValueMakeBoolean(_:_:))

Creates a JavaScript Boolean value.

[`JSValueMakeNumber(_:_:)`](/documentation/JavaScriptCore/JSValueMakeNumber(_:_:))

Creates a JavaScript value of the number type.

[`JSValueMakeString(_:_:)`](/documentation/JavaScriptCore/JSValueMakeString(_:_:))

Creates a JavaScript value of the string type.

[`JSValueMakeSymbol(_:_:)`](/documentation/JavaScriptCore/JSValueMakeSymbol(_:_:))

Creates a JavaScript value of the symbol type.

### Converting to Primitive Values

[`JSValueToBoolean(_:_:)`](/documentation/JavaScriptCore/JSValueToBoolean(_:_:))

Converts a JavaScript value to a Boolean and returns the resulting Boolean.

[`JSValueToNumber(_:_:_:)`](/documentation/JavaScriptCore/JSValueToNumber(_:_:_:))

Converts a JavaScript value to a number and returns the resulting number.

[`JSValueToStringCopy(_:_:_:)`](/documentation/JavaScriptCore/JSValueToStringCopy(_:_:_:))

Converts a JavaScript value to a string and copies the result into a JavaScript string.

[`JSValueToObject(_:_:_:)`](/documentation/JavaScriptCore/JSValueToObject(_:_:_:))

Converts a JavaScript value to an object and returns the resulting object.

### Converting to and from JSON-Formatted Strings

[`JSValueMakeFromJSONString(_:_:)`](/documentation/JavaScriptCore/JSValueMakeFromJSONString(_:_:))

Creates a JavaScript value from a JSON-formatted string.

[`JSValueCreateJSONString(_:_:_:_:)`](/documentation/JavaScriptCore/JSValueCreateJSONString(_:_:_:_:))

Creates a JavaScript string that contains the JSON-serialized representation of a JavaScript value.

### Comparing Values

[`JSValueIsEqual(_:_:_:_:)`](/documentation/JavaScriptCore/JSValueIsEqual(_:_:_:_:))

Tests whether two JavaScript values are equal.

[`JSValueIsStrictEqual(_:_:_:)`](/documentation/JavaScriptCore/JSValueIsStrictEqual(_:_:_:))

Tests whether two JavaScript values are strict equal.

[`JSValueIsInstanceOfConstructor(_:_:_:_:)`](/documentation/JavaScriptCore/JSValueIsInstanceOfConstructor(_:_:_:_:))

Tests whether a JavaScript value is an object that the specified constructor creates.

### Supporting Garbage Collection

[`JSValueProtect(_:_:)`](/documentation/JavaScriptCore/JSValueProtect(_:_:))

Protects a JavaScript value from garbage collection.

[`JSValueUnprotect(_:_:)`](/documentation/JavaScriptCore/JSValueUnprotect(_:_:))

Unprotects a JavaScript value from garbage collection.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)