├── LICENSE
├── README.md
├── native
└── app.js
└── reactjs
└── App.js
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Nika Shamiladze
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # array-identification
2 | array identification with reactjs and native js
3 |
--------------------------------------------------------------------------------
/native/app.js:
--------------------------------------------------------------------------------
1 | const arr = ["Hello", "HI"];
2 | const arrOff = [];
3 | const inputValue = "Hi";
4 |
5 | function Capitalize(Text) {
6 | let textToLowerCase = Text.toLowerCase();
7 | return textToLowerCase.charAt(0).toUpperCase()+textToLowerCase.slice(1).toLowerCase();
8 | }
9 |
10 | arr.map((item) => {
11 | arrOff.push(item.toLowerCase());
12 | arrOff.push(item.toUpperCase());
13 | arrOff.push(Capitalize(item));
14 | })
15 |
16 | if(arrOff.includes(inputValue)) {
17 | alert("equal");
18 | } else {
19 | alert("not equal");
20 | }
21 |
--------------------------------------------------------------------------------
/reactjs/App.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 |
3 | export default function App() {
4 | const [input, setInput] = useState("");
5 | function Capitalize(text) {
6 | let textToLowerCase = text.toLowerCase();
7 |
8 | return (
9 | textToLowerCase.charAt(0).toUpperCase() +
10 | textToLowerCase.slice(1).toLowerCase()
11 | );
12 | }
13 | const handleIdentification = (inp) => {
14 | const arr = ["Hello", "Hi", "What's up"];
15 | const arrOff = [];
16 | arr.map((item) => {
17 | arrOff.push(item.toLowerCase());
18 | arrOff.push(item.toUpperCase());
19 | arrOff.push(Capitalize(item));
20 | });
21 | if (arrOff.includes(inp)) {
22 | alert("equal");
23 | } else {
24 | alert("not equal");
25 | }
26 | console.log(arrOff);
27 | };
28 | return (
29 | <>
30 | setInput(e.target.value)}
34 | />
35 |
36 |
37 |
38 | >
39 | );
40 | }
41 |
--------------------------------------------------------------------------------