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
const smallestDivisor = (num) => { | |
const iter = (acc) => { | |
// We use 'num / 2' in the condition below, and not 'num'. | |
// This is a simple optimization: a number cannot be divided | |
// by a number larger than its half. | |
if (acc > num / 2) { | |
return num; | |
} | |
if (num % acc === 0) { | |
return acc; |
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
// BEGIN (write your solution here) | |
const smallestDivisor = num => { | |
let divisor = 2; | |
if(num < 1) { | |
return NaN; | |
} | |
if(num === 1) { | |
return num; |
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
import { length } from './strings'; // eslint-disable-line | |
// BEGIN (write your solution here) | |
const sum = (str) => { | |
let result = 0; | |
for(let i = 0; i < length(str); i++) { | |
result += Number(str[i]); | |
} | |
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
import { length, toUpperCase } from './strings'; | |
// BEGIN (write your solution here) | |
export default (str) => { | |
let result = ""; | |
for(let i = 0; i < length(str); i++) { | |
const shouldBeBig = str[i] !== " " && (i === 0 || str[i - 1] === " "); | |
result += shouldBeBig ? toUpperCase(str[i]) : str[i]; | |
} |
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
const isPalindrome = (string) => { | |
if (length(string) <= 1) { | |
return true; | |
} | |
const firstSymbol = string[0]; | |
const lastSymbol = string[length(string) - 1]; | |
if (firstSymbol !== lastSymbol) { | |
return false; | |
} |
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
import { getLength } from './strings'; // eslint-disable-line | |
// BEGIN (write your solution here) | |
const substr = (str, start = 0, size = getLength(str)) => { | |
const length = getLength(str); | |
if(start >= length) { | |
return ''; | |
} |
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
let webpack = require('webpack'); | |
let webpackDefaultConfig = require('./webpack-default'); | |
let Entry = require('./Entry'); | |
let webpackRules = require('./webpack-rules'); | |
let webpackPlugins = require('./webpack-plugins'); | |
process.noDeprecation = true; | |
class WebpackConfig { |
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
fs.js:143 | |
throw err; | |
^ | |
Error: EISDIR: illegal operation on a directory, read | |
at Object.fs.readSync (fs.js:632:3) | |
at tryReadSync (fs.js:472:20) | |
at Object.fs.readFileSync (fs.js:513:19) | |
at Function.concatenate.sync (C:\OpenServer\domains\crm2.local\node_modules\concatenate\lib\concatenate.js:122:17) | |
at FileCollection.merge (C:\OpenServer\domains\crm2.local\node_modules\laravel-mix\src\FileCollection.js:29:36) |
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
driver | |
.wait(until.elementLocated(By.css(createBtn)), 20000) | |
.then(function(element) { | |
return driver.wait(until.elementIsVisible(element), 20000); | |
}) | |
.then(function(button) { | |
driver | |
.actions() | |
.mouseMove(button) | |
.mouseUp() |