The RuntimeObject function is used to search a global object for properties with names that match a specified pattern. The function only locates properties of the global object that were explicitly created by VariableStatement or FunctionDeclaration functions, or that were implicitly created by appearing as an identifier on the left side of an assignment operator. The function does not locate properties that were created by means of explicit property access on the global object.

When the RuntimeObject function is called, the following steps are taken:

0. If pattern is present, set name to "*" and go to step 6.

1. Call the function toPrimitive(pattern, hint Number).

2. If the type of Result(2) is not String, raise a TypeError exception.

3. If Result(2) is the empty string, set name to "*" and go to step 6.

4. Set name = pattern.

5. Set the values of both leftWild and rightWild to false.

6. If the first character of name is "*", let leftWild be true, and remove the first character from name.

7. If the last character of name is "*", let rightWild be true, and remove the last character from name.

8. Let obj be a new ECMAScript object created as if by the expression new Object(), where Object is the original built-in constructor with that name.

9. Let enum be an enumeration of the names of the properties of the global object.

10. Let n be the next element of enum. If there are no more elements, return obj.

11. If n is the name of a built-in property defined by [ECMA-262-1999] Section 15.1, or by the implementation or the host environment, go to step 11.

12. If n was not created by variable instantiation ([ECMA-262-1999] Section 10.1.3), or by an assignment operator in which the left side was the identifier n, go to step 11.

13. If name is the empty string, go to step 19.

14. Search for the first substring name within n, and let left be the position within n of the first character of the matched substring, and let right be the position within n of the last character of the matched substring.

15. If a substring match was not found, go to step 11.

16. If leftWild is false and left is not 1, go to step 11.

17. If rightWild is false and right is not the last character position of n, go to step 11.

18. Let value be the result of calling the [[Get]] property of the global object, passing n as the argument.

19. If value is undefined, go to step 11.

20. Call the [[Put]] method of obj, passing n and value as arguments.

21. Go to step 11.

The length property of the RuntimeObject function has a value of 1.