Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                
// ============================================================================
var name = 'Практика';
console.log('Урок № 9 - ' + name);
// ============================================================================

/*
1. Дана строка. Сделайте заглавным первый символ этой строки не используя цикл.
 Найдите два решения.
*/

var string = 'дана строка';
var newString = string[0].toUpperCase() + string.substr(1);
console.log(newString);

var string = 'дана строка';
var newString = string.substr(0, 1).toUpperCase();
console.log(newString + string.substring(1));

var string = 'дана строка';
string = string.split('');
string[0] = string[0].toUpperCase();
var newString = string.join('');
console.log(newString);

// ============================================================================

/*
2. Дана строка, например, '123456'. Переверните эту строку (сделайте из нее
'654321') не используя цикл.
*/

var string = '123456';
string = string.split('').reverse().join('');
console.log(string);

// ============================================================================

/*
3. Дано число, например, 3751. Отсортируйте цифры в нем (сделайте из него 1357)
не используя цикл.
*/

var num = 3751;
var result = String(num).split('').sort().join('');
console.log(result);

// ============================================================================

// 4. Проверьте, что строка начинается на http://

var string = 'http://theory.phphtml.net';
if (string.substr(0, 7) === 'http://') {
  console.log('Строка начинаеть с ' + string.substr(0, 7));
} else {
  console.log('Строка начинаеться с чего-то другого');
}

// ============================================================================

// 5. Проверьте, что строка заканчивается на .html.

var string = 'http://theory.php.html';
if (string.substr(-5) === '.html') {
  console.log('Строка заканчиваеться на ' + string.substr(-5));
} else {
  console.log('Строка заканчиваеться чем-то другим');
}

              
            
!
999px

Console