dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
48 lines
806 B
Markdown
48 lines
806 B
Markdown
---
|
|
id: 661e151f068359c3ccf2f4d7
|
|
title: Basic Functions Exercise C
|
|
challengeType: 1
|
|
dashedName: top-basic-functions-exercise-c
|
|
---
|
|
|
|
# --description--
|
|
|
|
Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized.
|
|
|
|
# --hints--
|
|
|
|
You should have a function named `capitalize`.
|
|
|
|
```js
|
|
assert.isFunction(capitalize);
|
|
```
|
|
|
|
Your function should take in a string as a parameter.
|
|
|
|
```js
|
|
assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/);
|
|
```
|
|
|
|
Your function should return a new string with the first letter capitalized.
|
|
|
|
```js
|
|
assert.strictEqual(capitalize('sem'), 'Sem');
|
|
```
|
|
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```js
|
|
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```js
|
|
function capitalize(str) {
|
|
return str[0].toUpperCase() + str.slice(1);
|
|
}
|
|
```
|