Question: ```js
let ob = {};
ob[/\ing?$/] = `I match all strings end with "ing"`; //key is instance of 'RegEXp'
ob["/\ing?$/"] = `I am sure it is not same as the above`; //key is instance of 'String'

console.log(
`- Key RegExp :
   ==> ${ob[/\ing?$/]}
`);

console.log(
`- Key String :
   ==> ${ob["/\ing?$/"]}
`);
```

The above string demonstrates that literal object property can be an instance of `RegExp` class and it can be also `String` of course and they are totally different . 

My question is how to check if the type property using `Object.keys` or alternative . Known that using `Object.keys`, this method casts all keys (properties) to string ? 

```
Object.keys(ob);
 //--> Expected :[/\ing?$/, "/\ing?$/"]
 //--> Actual : ["/\ing?$/", "/ing?$/"]

```

Answer: 
Property names are always strings. If you try to use something else as a property name, it will be converted to a string using `toString()`. So when you do:

```
ob[/\ing?$/] = `I match all strings end with "ing"`; //key is instance of 'RegEXp';

```

it's treated as

```
ob[/\ing?$/.toString()] = `I match all strings end with "ing"`; //key is instance of 'RegEXp';

```

So the key is `"/\ing?$/"`.

When you do:

```
ob["/\ing?$/"] = `I am sure it is not same as the above`; //key is instance of 'String';

```

the key is the string `"/ing?$/"`. The backslash is gone because in a string literal, backslash is an escape character. `\i` just escapes the `i` character, but since `i` has no special meaning, it's just `i`.

If you wanted to get the same key as from the RegExp, it should be:

```
ob["/\\ing?$/"] = `I am sure it is not same as the above`; //key is instance of 'String';

```

The double backslash escapes the backslash, so it gets put into the string literally.

```js
let ob = {};
ob[/\ing?$/] = `I match all strings end with "ing"`; //key is instance of 'RegEXp';
ob["/\\ing?$/"] = `I am sure it is not same as the above`; //key is instance of 'String';
console.log(ob);
```
The properties are being converted to strings when they're set:

```
for (var key in ob) {
    console.log('key', key, 'type', typeof key);
}

> key /\ing?$/ type string
> key /ing?$/ type string

```