en.javascript.info/1-js/6-objects-more/2-object-conversion/2-tostring-valueof/task.md
2015-01-14 10:23:45 +03:00

24 lines
No EOL
400 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Преобразование
[importance 5]
Объявлен объект с `toString` и `valueOf`.
Какими будут результаты `alert`?
```js
var foo = {
toString: function () {
return 'foo';
},
valueOf: function () {
return 2;
}
};
alert(foo);
alert(foo + 1);
alert(foo + "3");
```
Подумайте, прежде чем ответить.