javascript - hello world
This commit is contained in:
parent
d61adb7f9b
commit
4c0cad064a
51
javascript/hello-world/README.md
Normal file
51
javascript/hello-world/README.md
Normal file
@ -0,0 +1,51 @@
|
||||
# Hello World
|
||||
|
||||
The classical introductory exercise. Just say "Hello, World!".
|
||||
|
||||
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
|
||||
the traditional first program for beginning programming in a new language
|
||||
or environment.
|
||||
|
||||
The objectives are simple:
|
||||
|
||||
- Write a function that returns the string "Hello, World!".
|
||||
- Run the test suite and make sure that it succeeds.
|
||||
- Submit your solution and check it at the website.
|
||||
|
||||
If everything goes well, you will be ready to fetch your first real exercise.
|
||||
|
||||
## Setup
|
||||
|
||||
Go through the setup instructions for Javascript to
|
||||
install the necessary dependencies:
|
||||
|
||||
[https://exercism.io/tracks/javascript/installation](https://exercism.io/tracks/javascript/installation)
|
||||
|
||||
## Requirements
|
||||
|
||||
Install assignment dependencies:
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
## Making the test suite pass
|
||||
|
||||
Execute the tests with:
|
||||
|
||||
```bash
|
||||
$ npm test
|
||||
```
|
||||
|
||||
In the test suites all tests but the first have been skipped.
|
||||
|
||||
Once you get a test passing, you can enable the next one by
|
||||
changing `xtest` to `test`.
|
||||
|
||||
|
||||
## Source
|
||||
|
||||
This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program)
|
||||
|
||||
## Submitting Incomplete Solutions
|
||||
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
12
javascript/hello-world/hello-world.js
Normal file
12
javascript/hello-world/hello-world.js
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// This is only a SKELETON file for the 'Hello World' exercise. It's been provided as a
|
||||
// convenience to get you started writing code faster.
|
||||
//
|
||||
|
||||
class HelloWorld {
|
||||
hello() {
|
||||
return 'Hello, World!';
|
||||
}
|
||||
}
|
||||
|
||||
export default HelloWorld;
|
9
javascript/hello-world/hello-world.spec.js
Normal file
9
javascript/hello-world/hello-world.spec.js
Normal file
@ -0,0 +1,9 @@
|
||||
import HelloWorld from './hello-world';
|
||||
|
||||
describe('Hello World', () => {
|
||||
const greeter = new HelloWorld();
|
||||
|
||||
test('says hello', () => {
|
||||
expect(greeter.hello()).toEqual('Hello, World!');
|
||||
});
|
||||
});
|
7060
javascript/hello-world/package-lock.json
generated
Normal file
7060
javascript/hello-world/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
80
javascript/hello-world/package.json
Normal file
80
javascript/hello-world/package.json
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "exercism-javascript",
|
||||
"version": "0.0.0",
|
||||
"description": "Exercism exercises in Javascript.",
|
||||
"author": "Katrina Owen",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/exercism/javascript"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-jest": "^21.2.0",
|
||||
"babel-plugin-transform-builtin-extend": "^1.1.2",
|
||||
"babel-preset-env": "^1.4.0",
|
||||
"eslint": "^3.19.0",
|
||||
"eslint-config-airbnb": "^15.0.1",
|
||||
"eslint-plugin-import": "^2.2.0",
|
||||
"eslint-plugin-jsx-a11y": "^5.0.1",
|
||||
"eslint-plugin-react": "^7.0.1",
|
||||
"jest": "^21.2.1"
|
||||
},
|
||||
"jest": {
|
||||
"modulePathIgnorePatterns": [
|
||||
"package.json"
|
||||
]
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": [
|
||||
{
|
||||
"node": "current"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"babel-plugin-transform-builtin-extend",
|
||||
{
|
||||
"globals": [
|
||||
"Error"
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"transform-regenerator"
|
||||
]
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest --no-cache ./*",
|
||||
"watch": "jest --no-cache --watch ./*",
|
||||
"lint": "eslint .",
|
||||
"lint-test": "eslint . && jest --no-cache ./* "
|
||||
},
|
||||
"eslintConfig": {
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"jest": true
|
||||
},
|
||||
"extends": "airbnb",
|
||||
"rules": {
|
||||
"import/no-unresolved": "off",
|
||||
"import/extensions": "off"
|
||||
}
|
||||
},
|
||||
"licenses": [
|
||||
"MIT"
|
||||
],
|
||||
"dependencies": {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user