-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,27 @@ | ||
--- | ||
title: Vlastnosti a metody | ||
demand: 1 | ||
lead: Vyzkoušejte si vlastnosti a metody řetězců. | ||
solutionAccess: lock | ||
--- | ||
|
||
V **konzoli prohlížeče** si založte proměnnou `title` a uložte do ní **název svého oblíbeného filmu** (např. _Pán prstenů_). Proveďte následující úkoly. | ||
V JavaScriptovém programu si založte proměnnou `title` a uložte do ní **název svého oblíbeného filmu** (např. _Pán prstenů_). Proveďte následující úkoly. | ||
|
||
1. Vypište do konzole **počet znaků** názvu. | ||
1. Vypište do stránky **počet znaků** názvu. | ||
1. Vypište název filmu převedený na **velká písmena**. | ||
1. Vypište z názvu **prvních pět** písmen. | ||
1. Vypište z názvu **posledních pět** písmen. | ||
|
||
:::solution | ||
|
||
```js | ||
const title = "Lord of the Rings" | ||
| ||
// Vypište do konzole počet znaků názvu. | ||
| ||
title.length | ||
| ||
// Převeďte název filmu na velká písmena. | ||
| ||
title.toUpperCase() | ||
| ||
// Vypište z názvu prvních pět písmen. | ||
| ||
title.slice(0, 5) | ||
| ||
// Vypište z názvu posledních pět písmen. | ||
| ||
title.slice(title.length - 5, title.length) | ||
const title = "Lord of the Rings"; | ||
document.innerHTML += title.length; | ||
document.innerHTML += `<br>`; | ||
document.innerHTML += title.toUpperCase(); | ||
document.innerHTML += `<br>`; | ||
document.innerHTML += title.slice(0, 5); | ||
document.innerHTML += `<br>`; | ||
document.innerHTML += title.slice(title.length - 5, title.length)Ł | ||
``` | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters