{"id":309371,"date":"2020-09-02T21:00:35","date_gmt":"2020-09-02T21:00:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=309371"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=309371","title":{"rendered":"\u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/517560\/\">\n<p><em><strong>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0412 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u0435 OTUS \u0432\u043d\u043e\u0432\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0446\u0435\u043b\u0443\u044e \u043b\u0438\u043d\u0435\u0439\u043a\u0443 \u043a\u0443\u0440\u0441\u043e\u0432 \u043f\u043e JavaScript. \u041f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0443\u0440\u043e\u043a\u0430 \u043f\u043e \u043a\u0443\u0440\u0441\u0443 <\/strong><\/em><a href=\"https:\/\/otus.pw\/C2z8\/\" rel=\"noopener noreferrer nofollow\"><em><strong>&#171;JavaScript Developer. Professional&#187;<\/strong><\/em><\/a><em><strong>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u043d\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0434\u0432\u0435\u0440\u0435\u0439 \u043f\u043e \u043a\u0443\u0440\u0441\u0430\u043c <\/strong><\/em><a href=\"https:\/\/otus.pw\/oKDC\/\" rel=\"noopener noreferrer nofollow\"><em><strong>&#171;React.js Developer&#187;<\/strong><\/em><\/a><em><strong> \u0438 <\/strong><\/em><a href=\"https:\/\/otus.pw\/t4Hs\/\" rel=\"noopener noreferrer nofollow\"><em><strong>&#171;JavaScript Developer. Basic&#187;<\/strong><\/em><\/a><em><strong>. \u041d\u0443 \u0430 \u043c\u044b \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430.<\/strong><\/em><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fa1\/2ff\/444\/fa12ff444fd5a8440945e3ac91f3daf4.png\" width=\"780\" height=\"439\"><figcaption><\/figcaption><\/figure>\n<hr>\n<p><a href=\"https:\/\/dev.to\/devabhijeet\/series\/8132\" rel=\"noopener noreferrer nofollow\"><em><strong>\u0424\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 (\u0432 2 \u0447\u0430\u0441\u0442\u044f\u0445)<\/strong><\/em><\/a><em><strong> <\/strong><\/em><\/p>\n<p><a href=\"https:\/\/dev.to\/devabhijeet\/all-front-end-interview-questions-asked-during-my-recent-job-hunt-1kge\" rel=\"noopener noreferrer nofollow\"><em>1. \u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445. <\/em><\/a><\/p>\n<p><a href=\"https:\/\/dev.to\/devabhijeet\/resources-for-interview-preparations-front-end-3o3j\" rel=\"noopener noreferrer nofollow\"><em>2. \u0420\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e (\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430). <\/em><\/a><\/p>\n<h3>\u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445<\/h3>\n<hr>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043f\u0430\u043d\u0434\u0435\u043c\u0438\u0438 COVID-19. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u043a \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e.<\/p>\n<p> \u0412\u043e\u043f\u0440\u043e\u0441\u044b \u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<ul>\n<li>\n<p>JS<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043d\u043e \u043b\u0438\u0448\u044c \u0434\u0430\u0435\u0442 \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043c\u043e\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439.<\/p>\n<p><em>\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e 20.08.2020. <\/em><a href=\"https:\/\/github.com\/devAbhijeet\/job-hunt-interview-questions-2020\/commit\/f4be0455a740db89e6c1dc48108123168b0e2ee9\" rel=\"noopener noreferrer nofollow\"><em>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c<\/em><\/a><em> \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/em><\/p>\n<h3>JS<\/h3>\n<p>1. \u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u043e\u0439 N, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u043b\u0430\u0434\u0438\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u043f\u0440\u0438\u0432\u044f\u0436\u0438\u0442\u0435 \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>array<\/code>.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/**  * [1,2,[3,4]] -&gt; [1,2,3,4]  *\/  let arr = [1,2,[3,4, [5,6, [7, [8, 9, 10]]]]]  function flatten(arr) {   return arr.reduce(function(acc, next){     let isArray =  Array.isArray(next)     return acc.concat(isArray ? flatten(next) : next)   }, []) }  if (!Array.prototype.flatten) {   Array.prototype.flatten = function() {     return flatten(this)   } } console.log(arr.flatten()); <\/code><\/pre>\n<p>2. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u043c\u0438\u0441 \u0441 \u043d\u0443\u043b\u044f<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">class CustomPromise {   state = \"PENDING\"   value = undefined   thenCallbacks = []   errorCallbacks = []    constructor(action) {     action(this.resolver.bind(this), this.reject.bind(this))   }    resolver(value) {     this.state = \"RESOLVED\"     this.value = value     this.thenCallbacks.forEach((callback) =&gt; {       callback(this.value)     })   }    reject(value) {     this.state = \"REJECTED\"     this.value = value     this.errorCallbacks.forEach((callback) =&gt; {       callback(this.value)     })   }    then(callback) {     this.thenCallbacks.push(callback)     return this    }    catch (callback) {     this.errorCallbacks.push(callback)     return this    } }  let promise = new CustomPromise((resolver, reject) =&gt; {   setTimeout(() =&gt; {     const rand = Math.ceil(Math.random(1 * 1 + 6) * 6)     if (rand &gt; 2) {       resolver(\"Success\")     } else {       reject(\"Error\")     }   }, 1000) })  promise   .then(function(response){     console.log(response)   })   .catch(function(error){     console.log(error)   }) <\/code><\/pre>\n<p>3. \u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0439\u0442\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u043f\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u043c\u0443 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0443, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e. \u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u043e\u043b\u044e.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/ O(M) function getMovies() {   return []; \/\/ [{id, name, year}] }  \/\/ O(R) function getRatings() {   return []; \/\/ [{id, movie_id, rating}]   0 &lt;= rating &lt;= 10   \/\/ e.g 9.3 }  \/**  * minAvgRating -&gt;  *    avgRating &gt;= minAvgRating  *  * sort -&gt;  *    name -&gt; ascending order movies by name  *   -name -&gt; descending  *  *    avgRating  *   *  * search -&gt;  *   'ave' -&gt; 'Avengers'  *   'avengers' -&gt; 'Avengers'  *   'AvengersInfinitywar' -&gt; 'Avengers'  *\/ const toLower = str =&gt; str.toLocaleLowerCase()  const getAvrgRating = (movie, movingWithRatings) =&gt; {   let count = 0;   return movingWithRatings.reduce((acc, value, index) =&gt; {     const movieMatch = movie.id === value.movie_id     if (movieMatch) {       acc+=value.rating       count++     }     if (index === movingWithRatings.length - 1) {       acc = acc\/count     }     return acc   }, 0) }  const isSubString = (str1, str2) =&gt; {   str1 = toLower(str1.split(\" \").join(\"\"))   str2 = toLower(str2.split(\" \").join(\"\"))   if (str1.length &gt; str2.length) {     return str1.startWith(str2)   } else {     return str2.startWith(str1)   } }  const moviesList = getMovies() const movingWithRatings = getRatings(); function queryMovies({ search, sort, minAvgRating }) {   let filteredMovies = movingWithRatings.filter(movie =&gt; getAvrgRating(movie, movingWithRatings) &gt;= minAvgRating);   filteredMovies = filteredMovies.map(movie =&gt; moviesList.filter(listItem =&gt; listItem.id === movie.movie_id).pop())   filteredMovies = filteredMovies.filter(movie =&gt; isSubString(toLower(movie.name), toLower(search)))   filteredMovies = filteredMovies.sort((a, b) =&gt; {     const isDescending = sort[0] === '-' ? true : false     let sortCopy = isDescending ? sort.slice(1) : sort     const value1 = a[sortCopy]     const value2 = b[sortCopy]     if (isDescending) {       return value1 &gt; value2 ? -1 : 1     }else {       return value1 &lt; value2 ? -1 : 1     }   })   filteredMovies = filteredMovies.map(movie =&gt; ({     ...movie,     avgRating: movingWithRatings.filter(ratedMovie =&gt; ratedMovie.movie_id === movie.id)[0].rating   }))   return filteredMovies } <\/code><\/pre>\n<p>4. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0432\u0441\u0435 <code>\u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/code> \u0438 <code>\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438<\/code> \u043f\u043e URL-\u0430\u0434\u0440\u0435\u0441\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u043e\u0442\u043d\u0435\u0441\u0438\u0442\u0435 \u0432\u0441\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043d\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.  <\/p>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/devAbhijeet\/cure-fit-interview-challenge\/tree\/master\/\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/a><\/p>\n<pre><code class=\"javascript\">\/\/service.js const POSTS_URL = `https:\/\/jsonplaceholder.typicode.com\/posts`; const COMMENTS_URL = `https:\/\/jsonplaceholder.typicode.com\/comments`;  export const fetchAllPosts = () =&gt; {   return fetch(POSTS_URL).then(res =&gt; res.json()); };  export const fetchAllComments = () =&gt; {   return fetch(COMMENTS_URL).then(res =&gt; res.json()); };   import { fetchAllPosts, fetchAllComments } from \".\/service\";    const fetchData = async () =&gt; {   const [posts, comments] = await Promise.all([     fetchAllPosts(),     fetchAllComments()   ]);    const grabAllCommentsForPost = postId =&gt;     comments.filter(comment =&gt; comment.postId === postId);    const mappedPostWithComment = posts.reduce((acc, post) =&gt; {     const allComments = grabAllCommentsForPost(post.id);     acc[post.id] = allComments;     return acc;   }, {});    console.log(\"mappedPostWithComment \", mappedPostWithComment); };  fetchData(); <\/code><\/pre>\n<p>5. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 <code>getHashCode<\/code> \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 string. \u041c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">let s1 = \"sample\"  if (!String.prototype.getHashCode) {   String.prototype.getHashCode = function(){     console.log('String instance ', this)     return this   } } <\/code><\/pre>\n<p> 6. \u041a\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439?<\/p>\n<pre><code class=\"javascript\">    1+true     true+true     \u20181\u2019+true     \u20182\u2019 &gt; \u20193\u2019     \u2018two\u2019&gt;\u2019three\u2019 <\/code><\/pre>\n<p> \u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">2 2 1true false true<\/code><\/pre>\n<p>7. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u044b <code>bind<\/code> \u0438 <code>reduce<\/code>.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/bind if (!Function.prototype.bind) {   Function.prototype.bind = function(...arg){     const func = this     const context = arg[0]     const params = arg.slice(1)     return function(...innerParam) {       func.apply(context, [...params, ...innerParam])     }   } }  \/\/reduce Array.prototype.reduce = function(func, initState) {   const arr = this   const callback = func   let init = initState    arr.forEach(function(value, index){       init=callback(init, value)   })   return init } <\/code><\/pre>\n<p>8. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e debounce<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const debounce = function(func, interval) {   let timerId;   return function(e){     clearTimeout(timerId)     timerId = setTimeout(function(){       func.apply()     }, interval)   } } debounce(apiCall, 3000) <\/code><\/pre>\n<p>9. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e throttle<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const throttle = (callback, interval) =&gt; {   let timerId;   let allowEvents = true;    return function() {     let context = this;     let args = arguments;      if (allowEvents) {       callback.apply(context, args)       allowEvents = false;       timerId = setTimeOut(function(){         allowEvents = true       }, interval)     }   } } <\/code><\/pre>\n<p>10. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f API. \u0412\u044b\u0437\u043e\u0432 API \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b. \u042d\u0442\u043e API \u0444\u043e\u043d\u0434\u043e\u0432\u043e\u0433\u043e \u0440\u044b\u043d\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043a\u043e\u0442\u0438\u0440\u043e\u0432\u043a\u0430\u0445. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u0435 \u0438\u0445 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435.<\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u043a\u043e\u0434 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 setInterval, \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430 throttle \u0438 \u0444\u043b\u0430\u0433\u043e\u0432 setInterval=&gt;Endpoint=&gt;Render  \/\/\u0441 \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \/\/Endpoint=&gt;Render=&gt;setTimeout=&gt;Endpoint=&gt;Render=&gt;SetTimeout...<\/code><\/pre>\n<p>11. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0432 ES5.<\/p>\n<pre><code class=\"javascript\">class Parent(name){   constructor(name) {     this.name=name   }    getName(){return this.name} }  class Children extends Parent {   constructor(props){     super(props)   } }<\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">function Parent(name) {   this.name = name }  Parent.prototype.getName = function() {   return this.name }  function Children(name){   Parent.call(this, name) }  Children.prototype = new Parent() <\/code><\/pre>\n<p>12. \u0427\u0442\u043e \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434?<\/p>\n<pre><code class=\"javascript\">\/\/Q.1 var x = 1; var y = x;  x = 0; console.log(x, y);  \/\/Q.2 var x = [1]; var y = x;  x = []; console.log(x,y);  \/\/Q.3 function Abc() { console.log(this); }; Abc() new Abc();  \/\/Q.4 var x = 1; var obj = {   x: 2,   getX: function () {     return console.log(this.x);   } };  obj.getX() let a = obj.getX console.log(a)  \/\/Q.5 \/\/\u041a\u0430\u043a \u0432\u044b\u0432\u0435\u0441\u0442\u0438 2 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 a \u0432 \u043a\u043e\u0434\u0435 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430?  \/\/Q.6 console.log(\"A\"); setTimeout(() =&gt; console.log(\"B\"), 0); setTimeout(() =&gt; console.log(\"C\"), 0); console.log(\"D\");  \/\/Q.7 setTimeout(function() {   console.log(\"A\"); }, 0); Promise.resolve().then(function() {   console.log(\"B\"); }).then(function() {   console.log(\"C\"); });  console.log(\"D\");  \/\/Q.8 let obj1 = {   a:1,   b:2 }  function mutate(obj) {   obj = {a:4, c:6} }  console.log(obj1) mutate(obj1) console.log(obj1) <\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/A.1 0 1  \/\/A.2 [] [1]  \/\/A.3 \u0411\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442 window  \/\/A.4 \u0411\u0443\u0434\u0443\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 2 \u0438 1  \/\/A.5 a.call(obj);  \/\/A.6 A, D, B , C  \/\/A.7 D, B, C, A  \/\/A.8 { a: 1, b: 2 } { a: 1, b: 2 }<\/code><\/pre>\n<p> 13. \u0415\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b. \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/p>\n<pre><code class=\"javascript\">const list = [1,2,3,4,5,6,7,8] const filteredArray = list.filter(between(3, 6)) \/\/ [4,5]<\/code><\/pre>\n<p> \u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">function between(start, end) {   return function (value,index) {     return value&gt;start &amp;&amp; value&lt;end   } }<\/code><\/pre>\n<h3>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b<\/h3>\n<p>1. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"javascript\">A := 1 B := A*2 + 2 C := B*2 + 3 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435...<\/code><\/pre>\n<p>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f :<\/p>\n<ul>\n<li>\n<p>\u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0447\u0438\u0441\u043b\u043e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 &#8216;GREP&#8217;, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u0447\u0438\u0441\u0435\u043b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0431\u0443\u043a\u0432\u0430\u043c \u0441\u0442\u0440\u043e\u043a\u0438 (\u0442.&nbsp;\u0435. G + R + E + P) \u0438\u0437 \u044d\u0442\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438;  <\/p>\n<\/li>\n<li>\n<p>\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u0443\u044e \u043a\u043e\u0440\u043e\u0442\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 (\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e 32-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0433\u043e \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430).<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0436\u0430\u0434\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u0427\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0443\u043a\u0432\u0430\u043c, \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041d\u0415 \u041d\u0423\u0416\u041d\u041e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0438\u0445 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>\/\/A = 1 \/\/B = A*2 +2  \/\/C = B*2+ 3 \/\/D = C*2+ 3  var genCharArray = function(charA, charZ) {     var a = [], i = charA.charCodeAt(0), j = charZ.charCodeAt(0);     for (; i &lt;= j; ++i) {         a.push(String.fromCharCode(i));     }     return a; }  var charMap = {}; var charArray = genCharArray('a', 'z');  charArray.forEach(function(char, index){     charMap[char] = Number(index + 1); });   var charSequence = function(char){     if(typeof char===\"string\"){         char = charMap[char];     }     if(char==1){         return 1;     }else{         return char + 2 * charSequence(char-1);     } }  var input = process.argv[2];  if(input.length===1){     console.log(charSequence(charMap[input])); }else if(input.length&gt;1){     var charTotalSequence = input.split(\"\").reduce(function(acc, curr){          return acc + charSequence(charMap[curr]);     },0);     console.log(charTotalSequence); }<\/code><\/pre>\n<p>2. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u0430\u0440\u0443 \u0447\u0438\u0441\u0435\u043b, \u0441\u0443\u043c\u043c\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">let nums = [2, 7, 10, 1, 11, 15, 9] let target = 11 let numsMap = new Map() let pairs = nums.reduce((acc, num) =&gt; {   let numToFind = target - num   if (numsMap.get(numToFind)) {     return [...acc, [num, numToFind]]   } else {     numsMap.set(num, true)     return [...acc]   } }, [])  console.log(\"Pairs \", pairs)<\/code><\/pre>\n<p>3. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435. \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c&nbsp;\u2014 \u044d\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0440\u0430\u0432\u0430 \u0438 \u0441\u043b\u0435\u0432\u0430 \u043e\u0442 \u043d\u0435\u0433\u043e. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u043e\u0442\u0430\u0446\u0438\u044e O(n). \u042d\u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>let x = [1, 2, 3, 5, 4] \/\/\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b: 5 if x.length == 1 return x[0] else   let i = 1  for(;i&lt;x.length-1;i++){   if x[i-1]&lt;x[i] and x[i] &gt; x[i+1] return x[i]  }  if x.length - 1 == i return x[i]<\/code><\/pre>\n<p>4. \u041f\u043e\u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0430 90 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c in-place, \u00ab\u043d\u0430 \u043c\u0435\u0441\u0442\u0435\u00bb).<\/p>\n<p><a href=\"https:\/\/leetcode.com\/problems\/rotate-image\/\" rel=\"noopener noreferrer nofollow\">leetcode<\/a><\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>[  [1, 2, 3],  [4, 5, 6],  [7, 8, 9] ] \/\/\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443. \/\/\u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a. [  [1, 4, 7],  [2, 5, 8],  [3, 6, 9] ] \/\/\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439. \/\/\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a. [  [7, 4, 1],  [8, 5, 2],  [9, 6, 3] ] \/\/\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430 \u043d\u0430 90 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432.<\/code><\/pre>\n<p>5. \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e M.<\/p>\n<p><a href=\"https:\/\/www.geeksforgeeks.org\/maximum-subarray-sum-modulo-m\/\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>6. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0442\u0440\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0441\u0443\u043c\u043c\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>let x = [1, 2, 3, 4, 5] let target = 7 let found = []  const twoPointer = (l ,r, current) =&gt; {   while(l&lt;r){     const totalSum = current + x[l] + x[r]     if (totalSum === target) {       found.push([current, x[l], x[r]])       return     } else if (totalSum &gt; target) {       r--     } else {       l++     }   } }  const threeSum = (x, target) =&gt; {     for (let i=0;i&lt;x.length;i++) {       const current = x[i];       let leftPointer = i+1       let rightPointer = x.length - 1        if (current+x[leftPointer]+x[rightPointer] === target) {         found.push([current, x[leftPointer], x[rightPointer]])       } else {         twoPointer(leftPointer, rightPointer, current)       }   }   return found }<\/code><\/pre>\n<p>7. \u0415\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430 \u0438 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e k. \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e k \u0440\u0430\u0437.<\/p>\n<p><a href=\"https:\/\/www.geeksforgeeks.org\/number-substrings-count-character-k\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a><\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const subStrHasSameCharCount = (str, startIndex, endIndex, totalHop) =&gt; {   let charMap = {}   for (let k=startIndex;k&lt;endIndex;k++) {     let currentChar = str[k]     if (charMap[currentChar]) {       charMap[currentChar]++     } else {       charMap[currentChar] = 1     }   }   let totalCount = Object.values(charMap).length &gt; 0   return totalCount ? Object.values(charMap).every(item =&gt; item == totalHop) : false }   const characterWithCountK = (str, k) =&gt; {   if (k == 0) return ''   let count = 0   let initialHop = k   while (initialHop &lt; str.length) {     for (let j=0;j&lt;str.length;j++) {       let startIndex = j       let endIndex = j + initialHop       if(endIndex &gt; str.length) continue       count = subStrHasSameCharCount(str, startIndex, endIndex, k)         ? count + 1: count     }     initialHop+=k   }   count = subStrHasSameCharCount(str, 0, initialHop, k)         ? count + 1: count   return count }   let str = 'aabbcc' let k = 2 console.log(characterWithCountK(str, k)) <\/code><\/pre>\n<p>8. \u0415\u0441\u0442\u044c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438&nbsp;\u2014 s1 \u0438 s2, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043e\u0442 a \u0434\u043e z \u0432 \u0440\u0430\u0437\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 s1 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u0442\u0430\u043b\u0438 \u0440\u0430\u0432\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">let s1 = 'dadbcbc' let s2 = 'ccbbdad' let charMap = {}  const canBeRearranged = (s1, s2) =&gt; {   if(s1.length!==s2.length){     return false   }   for(let i=0;i&lt;s1.length;i++){     const charFromString1 = s1[i]     const charFromString2 = s2[i]     if(charFromString1 in charMap){       charMap[charFromString1]++     } else {       charMap[charFromString1] = 1     }     if(charFromString2 in charMap){       charMap[charFromString2]--     } else {       charMap[charFromString2] = -1     }   }   for(let x in charMap){     if (charMap[x]!==0){       return false     }   }   return true }  canBeRearranged(s1, s2) <\/code><\/pre>\n<p>9. \u0415\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043e\u0439. \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const swap = (index1, index2, arr) =&gt; {   let temp = arr[index1]   arr[index1] = arr[index2]   arr[index2] = temp }  const shuffle = (arr) =&gt; {   let totalLength = arr.length   while(totalLength &gt; 0) {     let random = Math.floor(Math.random() * totalLength)     totalLength--     swap(totalLength, random, arr)   }   return arr }   let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] arr = shuffle(arr)<\/code><\/pre>\n<p>10. \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0441\u0443\u043c\u043c\u0443 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u043e\u0439.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">let arr = [4, 5, 7, 8, [5, 7, 9, [3, 5, 7]]] let sum = 0  const calculateSum = (arr) =&gt; {   arr.reduce(function(acc, currentVal) {     const isEntryArray = Array.isArray(currentVal)     if (isEntryArray) {       return acc.concat(calculateSum(currentVal))     } else {       sum+=currentVal       return acc.concat(currentVal)     }   }, []) } calculateSum(arr) console.log(sum) <\/code><\/pre>\n<p> 11. \u0421\u0433\u043b\u0430\u0434\u044c\u0442\u0435 \u043c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const obj = {   level1: {     level2: {       level3: {         more: 'stuff',          other: 'otherz',         level4: {           the: 'end',         },       },     },     level2still: {       last: 'one',     },     am: 'bored',   },   more: 'what',   ipsum: {     lorem: 'latin',   }, };  var removeNesting = function(obj, parent){   for (let key in obj){     if (typeof obj[key] === \"object\") {       removeNesting(obj[key], parent+\".\"+key)     } else {       flattenedObj[parent+'.'+key] = obj[key]     }   } }  let flattenedObj = {} const sample = removeNesting(obj, \"\"); console.log(flattenedObj);<\/code><\/pre>\n<p>12. \u0415\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0438 \u043c\u043e\u0436\u0435\u0442, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430.<\/p>\n<p><a href=\"https:\/\/jsbin.com\/gajiweq\/1\/edit?js,console\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>13. \u0415\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430\u0445 (\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0447\u0438\u043d\u0435\u043d\u043d\u044b\u0445). \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const employeesData = [{   id: 2,   name: '\u0410\u043d\u0434\u0440\u0435\u0439 (\u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440)',   reportees: [6]  }, {   id: 3,   name: '\u0410\u043b\u0435\u043a\u0441\u0435\u0439 (\u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440)',   reportees: [] }, {   id: 6,   name: '\u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 (\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b)',   reportees: [9]  }, {   id: 9,   name: '\u0410\u043d\u0430\u0442\u043e\u043b\u0438\u0439 (\u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440)',   reportees: [] }, {   id: 10,   name: '\u0410\u043d\u0442\u043e\u043d (\u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440)',   reportees: [2, 3], }];  \/* A (\u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440) ----B (\u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440) --------D (\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b) ------------E (\u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a) ----C (\u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440) *\/  const findCeo = (currentEmp) =&gt; {   let parentEmployee = employeesData.filter(emp =&gt; emp.reportees.indexOf(currentEmp.id) &gt; -1)   if (parentEmployee &amp;&amp; parentEmployee.length &gt; 0) {     return findCeo(parentEmployee[0])   } else {     return currentEmp   } }  const logHierarchy = (currentEmp, indent) =&gt; {   console.log(\"-\".repeat(indent) + currentEmp.name)   indent+=4;   for(let i=0;i &lt;currentEmp.reportees.length;i++) {     let employee = employeesData.filter(emp =&gt; emp.id === currentEmp.reportees[i])     logHierarchy(employee[0], indent)   } }  const traverse = (employee) =&gt; {   let ceo = findCeo(employee)   logHierarchy(ceo, 0) }  traverse(employeesData[0])<\/code><\/pre>\n<p>14. \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0439\u0442\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0432 \u0441\u043f\u0438\u0440\u0430\u043b\u044c\u043d\u0443\u044e \u0438 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d<\/p>\n<pre><code class=\"javascript\">const inputMatrix = [   [1, 2, 3, 4,  5],   [6, 7, 8, 9, 10],   [11,12,13,14,15],   [16,17,18,19,20], ]  const exprectOutput = [1,2,3,4,5,10,15,20,19,18,17,16,11,6,7,8,9,14,13,12]<\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">function spiralParser(inputMatrix){   const output = [];   let rows = inputMatrix.length;   let cols = rows &gt; 0 ? inputMatrix[0].length : 0;    \/\/singleEmptyRow =&gt; Edge case 1 \/\/[]   if (rows === 0) {     return []   }    if (rows === 1) {     \/\/singleElementRowNoCol =&gt; Edge case 2 \/\/[[]]     if (cols === 0) {       return []     } else if (cols === 1){       \/\/singleElementRow =&gt; Edge case 3 \/\/[[1]]       output.push(inputMatrix[0][0])       return output      }   }    let top = 0;   let bottom = rows - 1;   let left = 0;   let right = cols - 1;   let direction = 0;   \/\/0 =&gt; left-&gt;right   \/\/1 =&gt; top-&gt;bottom   \/\/2 =&gt; right-&gt;left   \/\/3 =&gt; bottom-&gt;top    while(left &lt;= right &amp;&amp; top &lt;= bottom) {     if(direction === 0) {       \/\/left-&gt;right       for (let i=left; i&lt;=right;i++) {         output.push(inputMatrix[top][i])       }       top++;     } else if (direction === 1) {       \/\/top-&gt;bottom       for (let i=top; i&lt;=bottom;i++) {         output.push(inputMatrix[i][right])       }       right--     } else if (direction === 2) {       \/\/right-&gt;left       for (let i=right; i&gt;=left;i--) {         output.push(inputMatrix[bottom][i])       }       bottom--     } else if (direction === 3) {       \/\/bottom-&gt;top       for (let i=bottom; i&gt;=top;i--) {         output.push(inputMatrix[i][left])       }       left++     }     direction = (direction + 1) % 4   }   return output; }  console.log(spiralParser(inputMatrix2))<\/code><\/pre>\n<p>15. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0441\u0438\u043c\u0432\u043e\u043b \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<pre><code class=\"javascript\">let str = 'bbbaaaaccadd'; \/\/\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 (4) \u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 a<\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/\u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 maxNow = \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0440\u0430\u0432\u043d\u04301 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 1 ? 1 : 0 maxOverall = \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0440\u0430\u0432\u043d\u04301 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 1 ? 1 : 0  \u0434\u043b\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 1 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435   \u0435\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u0440\u0430\u0432\u0435\u043d \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0443     maxNow++ \/\/\u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043d\u0430 1     maxOverall = max(maxOverall, maxNow)   \u0438\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0435 \u0440\u0430\u0432\u0435\u043d \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0443         maxNow = 1<\/code><\/pre>\n<p> 16. \u0415\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b. \u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432\u0441\u0435 \u0434\u0432\u043e\u0439\u043a\u0438 (2) \u0432 \u043a\u043e\u043d\u0435\u0446 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<pre><code class=\"javascript\">let inputArr = [2,9,1,5,2,3,1,2,7,4,3,8,29,2,4,6,54,32,2,100] \/\/ouput =&gt; [9,1,5,3,1,7,4,3,8,29,4,6,54,32,100,2,2,2,2,2]<\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">let slowRunner = 0  for (let fastRunner=0;fastRunner&lt;arr.length;fastRunner++) {   if (arr[fastRunner]!==2 &amp;&amp; arr[slow] == 2) {     [arr[fastRunner], arr[slow]] = [arr[slow], arr[fastRunner]]     slowRunner++   } }<\/code><\/pre>\n<p> 17. \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<pre><code class=\"javascript\">\/\/\u041d\u0430 \u0432\u0445\u043e\u0434\u0435 = 1 -&gt; 2 -&gt; 3 -&gt; 4 -&gt; 5 -&gt; 6 \/\/\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 = 1 &lt;- 2 &lt;- 3 &lt;- 4 &lt;- 5 &lt;- 6<\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/\u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 let current = head let prev = null let next = null  while(current) {   next = current.next   current.next = prev   prev = current   current = next }<\/code><\/pre>\n<p>18. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u043f\u0440\u044f\u043c\u043e\u0439 \u043e\u0431\u0445\u043e\u0434 \u0434\u0435\u0440\u0435\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 (\u0431\u0435\u0437 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438)<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/\u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 const preorder = (root) =&gt; {   let stack = []   stack.push(root)    \u043f\u043e\u043a\u0430(\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f stack \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435) {     let current = stack.pop()     console.log(current.value)     if (current.right) {       stack.push(current.right)     }     if (current.left) {       stack.push(current.left)     }   } }<\/code><\/pre>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>1. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0439\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u043a\u043e\u0432\u043a\u0438, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0443\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c.<\/p>\n<ul>\n<li>\n<p>\u041e\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431 N \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f\u0445. \u041e\u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043f\u0430\u0440\u043a\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u043c\u0435\u0441\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u044a\u0435\u0437\u0436\u0430\u044e\u0449\u0438\u0435 \u0438 \u0432\u044b\u0435\u0437\u0436\u0430\u044e\u0449\u0438\u0435 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u0447\u0435\u0442\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u0432\u044a\u0435\u0437\u0436\u0430\u044e\u0449\u0438\u0435 \u0438 \u0432\u044b\u0435\u0437\u0436\u0430\u044e\u0449\u0438\u0435 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c: \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440, \u0446\u0432\u0435\u0442, \u043f\u0430\u0440\u043a\u043e\u0432\u043e\u0447\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u0441\u0435\u0445 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u043d\u043e\u043c\u0435\u0440 \u043f\u0430\u0440\u043a\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c\u0443 \u043d\u043e\u043c\u0435\u0440\u0443;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0430\u0440\u043a\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u043a\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u043c\u0435\u0441\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438\/\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438;<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u043c \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<ul>\n<li>\n<p>\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b SOLID.<\/p>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/devAbhijeet\/parking-lot-design-js\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>2. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>Ping<\/code>, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e API \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 URL. \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f 200, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432 \u0421\u0435\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0434 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0432 \u0421\u0435\u0442\u0438.<\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c <code>\u0441\u0442\u0430\u0442\u0443\u0441<\/code> \u0438\u0437 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 dev tools.<\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/admiring-davinci-xnjef\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>3. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u043e\u0440\u043c \u043d\u0430 \u0431\u0430\u0437\u0435 <code>json<\/code>. \u0424\u043e\u0440\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e <code>id<\/code>. \u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u0430\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430.<\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/great-noyce-75kup\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>4. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c JavaScript \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043b\u0438\u0441\u0442 Excel, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e <code>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c<\/code> \u0438 <code>\u0443\u0434\u0430\u043b\u044f\u0442\u044c<\/code> \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b. \u041d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0442\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c 40 \u043c\u0438\u043d\u0443\u0442.<\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/smoosh-thunder-krv8m\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>5. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 user (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c) \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044f.<\/p>\n<pre><code>id: \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u043c\u044f: \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u044b: \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0437\u0430\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0430\u0434\u0440\u0435\u0441: \u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u043b\u044c\u0437\u043e \u0438\u043d\u0434\u0435\u043a\u0441: \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/code><\/pre>\n<p>\u041f\u043e\u0438\u0441\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044f\u043c.<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p><strong>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/strong><br \/> \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0438\u0441\u043a\u0430, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u041f\u043e\u0438\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<p>\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0438\u043b\u0438 \u043c\u044b\u0448\u044c\u044e.<br \/> \u0415\u0441\u043b\u0438 \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0430, \u0438 \u043c\u044b\u0448\u044c, \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430.<\/p>\n<p>(\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0435\u0441\u043b\u0438 \u043c\u044b\u0448\u044c \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430. \u0415\u0441\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b\u0448\u0438.)<\/p>\n<p>\u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 YouTube<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u0430\u044f \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430.<br \/> \u0421\u043f\u0438\u0441\u043e\u043a \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u041f\u043e\u0434\u0441\u0432\u0435\u0447\u0435\u043d\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0438\u043b\u0438 \u043c\u044b\u0448\u0438) \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/silly-moon-31m7u\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/a> <\/p>\n<h3>\u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/h3>\n<p> 1. \u041a\u0430\u043a \u0431\u044b \u0432\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435? <a href=\"https:\/\/dev.to\/vycke\/how-to-create-a-scalable-and-maintainable-front-end-architecture-4f47\" rel=\"noopener noreferrer nofollow\">(\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c)<\/a><br \/> 2. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u043b\u0435\u043d\u0438\u0432\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <a href=\"https:\/\/css-tricks.com\/the-complete-guide-to-lazy-loading-images\/\" rel=\"noopener noreferrer nofollow\">(\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c)<\/a><br \/> 3. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433?<br \/> 4. \u041a\u0430\u043a \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435? <br \/> 5. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u0435\u0440\u0432\u0438\u0441-\u0432\u043e\u0440\u043a\u0435\u0440 (\u0432\u0435\u0431-\u0432\u043e\u0440\u043a\u0435\u0440)?<br \/> 6. \u041a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c?<br \/> 7. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f\u0445 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<br \/> 8. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 CORS?<br \/> 9. \u041d\u0430\u0437\u043e\u0432\u0438\u0442\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432\u044b\u0441\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432 React.<br \/> 10. \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f connect \u0432 Redux? <br \/> 11. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PureComponent \u0432 React?<\/p>\n<h3>\u0420\u0435\u0441\u0443\u0440\u0441\u044b <\/h3>\n<p><a href=\"https:\/\/github.com\/devAbhijeet\/learning-resources\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a><\/p>\n<hr>\n<h2>\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e \u043a\u0443\u0440\u0441\u0435:<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/otus.pw\/C2z8\/\" rel=\"noopener noreferrer nofollow\"><strong>&#171;JavaScript Developer. Professional&#187;<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/otus.pw\/oKDC\/\" rel=\"noopener noreferrer nofollow\"><strong>&#171;React.js Developer&#187;<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/otus.pw\/t4Hs\/\" rel=\"noopener noreferrer nofollow\"><strong>&#171;JavaScript Developer. Basic&#187;<\/strong><\/a><\/p>\n<\/li>\n<\/ul>\n<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/517560\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/517560\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/517560\/\">\n<p><em><strong>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0412 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u0435 OTUS \u0432\u043d\u043e\u0432\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0446\u0435\u043b\u0443\u044e \u043b\u0438\u043d\u0435\u0439\u043a\u0443 \u043a\u0443\u0440\u0441\u043e\u0432 \u043f\u043e JavaScript. \u041f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0443\u0440\u043e\u043a\u0430 \u043f\u043e \u043a\u0443\u0440\u0441\u0443 <\/strong><\/em><a href=\"https:\/\/otus.pw\/C2z8\/\" rel=\"noopener noreferrer nofollow\"><em><strong>&#171;JavaScript Developer. Professional&#187;<\/strong><\/em><\/a><em><strong>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u043d\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0434\u0432\u0435\u0440\u0435\u0439 \u043f\u043e \u043a\u0443\u0440\u0441\u0430\u043c <\/strong><\/em><a href=\"https:\/\/otus.pw\/oKDC\/\" rel=\"noopener noreferrer nofollow\"><em><strong>&#171;React.js Developer&#187;<\/strong><\/em><\/a><em><strong> \u0438 <\/strong><\/em><a href=\"https:\/\/otus.pw\/t4Hs\/\" rel=\"noopener noreferrer nofollow\"><em><strong>&#171;JavaScript Developer. Basic&#187;<\/strong><\/em><\/a><em><strong>. \u041d\u0443 \u0430 \u043c\u044b \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430.<\/strong><\/em><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<hr>\n<p><a href=\"https:\/\/dev.to\/devabhijeet\/series\/8132\" rel=\"noopener noreferrer nofollow\"><em><strong>\u0424\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 (\u0432 2 \u0447\u0430\u0441\u0442\u044f\u0445)<\/strong><\/em><\/a><em><strong> <\/strong><\/em><\/p>\n<p><a href=\"https:\/\/dev.to\/devabhijeet\/all-front-end-interview-questions-asked-during-my-recent-job-hunt-1kge\" rel=\"noopener noreferrer nofollow\"><em>1. \u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445. <\/em><\/a><\/p>\n<p><a href=\"https:\/\/dev.to\/devabhijeet\/resources-for-interview-preparations-front-end-3o3j\" rel=\"noopener noreferrer nofollow\"><em>2. \u0420\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e (\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430). <\/em><\/a><\/p>\n<h3>\u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445<\/h3>\n<hr>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043f\u0430\u043d\u0434\u0435\u043c\u0438\u0438 COVID-19. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u043a \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e.<\/p>\n<p> \u0412\u043e\u043f\u0440\u043e\u0441\u044b \u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<ul>\n<li>\n<p>JS<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043d\u043e \u043b\u0438\u0448\u044c \u0434\u0430\u0435\u0442 \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043c\u043e\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439.<\/p>\n<p><em>\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e 20.08.2020. <\/em><a href=\"https:\/\/github.com\/devAbhijeet\/job-hunt-interview-questions-2020\/commit\/f4be0455a740db89e6c1dc48108123168b0e2ee9\" rel=\"noopener noreferrer nofollow\"><em>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c<\/em><\/a><em> \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/em><\/p>\n<h3>JS<\/h3>\n<p>1. \u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u043e\u0439 N, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u043b\u0430\u0434\u0438\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u043f\u0440\u0438\u0432\u044f\u0436\u0438\u0442\u0435 \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>array<\/code>.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/**  * [1,2,[3,4]] -&gt; [1,2,3,4]  *\/  let arr = [1,2,[3,4, [5,6, [7, [8, 9, 10]]]]]  function flatten(arr) {   return arr.reduce(function(acc, next){     let isArray =  Array.isArray(next)     return acc.concat(isArray ? flatten(next) : next)   }, []) }  if (!Array.prototype.flatten) {   Array.prototype.flatten = function() {     return flatten(this)   } } console.log(arr.flatten()); <\/code><\/pre>\n<p>2. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u043c\u0438\u0441 \u0441 \u043d\u0443\u043b\u044f<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">class CustomPromise {   state = \"PENDING\"   value = undefined   thenCallbacks = []   errorCallbacks = []    constructor(action) {     action(this.resolver.bind(this), this.reject.bind(this))   }    resolver(value) {     this.state = \"RESOLVED\"     this.value = value     this.thenCallbacks.forEach((callback) =&gt; {       callback(this.value)     })   }    reject(value) {     this.state = \"REJECTED\"     this.value = value     this.errorCallbacks.forEach((callback) =&gt; {       callback(this.value)     })   }    then(callback) {     this.thenCallbacks.push(callback)     return this    }    catch (callback) {     this.errorCallbacks.push(callback)     return this    } }  let promise = new CustomPromise((resolver, reject) =&gt; {   setTimeout(() =&gt; {     const rand = Math.ceil(Math.random(1 * 1 + 6) * 6)     if (rand &gt; 2) {       resolver(\"Success\")     } else {       reject(\"Error\")     }   }, 1000) })  promise   .then(function(response){     console.log(response)   })   .catch(function(error){     console.log(error)   }) <\/code><\/pre>\n<p>3. \u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0439\u0442\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u043f\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u043c\u0443 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0443, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e. \u041e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u043e\u043b\u044e.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/ O(M) function getMovies() {   return []; \/\/ [{id, name, year}] }  \/\/ O(R) function getRatings() {   return []; \/\/ [{id, movie_id, rating}]   0 &lt;= rating &lt;= 10   \/\/ e.g 9.3 }  \/**  * minAvgRating -&gt;  *    avgRating &gt;= minAvgRating  *  * sort -&gt;  *    name -&gt; ascending order movies by name  *   -name -&gt; descending  *  *    avgRating  *   *  * search -&gt;  *   'ave' -&gt; 'Avengers'  *   'avengers' -&gt; 'Avengers'  *   'AvengersInfinitywar' -&gt; 'Avengers'  *\/ const toLower = str =&gt; str.toLocaleLowerCase()  const getAvrgRating = (movie, movingWithRatings) =&gt; {   let count = 0;   return movingWithRatings.reduce((acc, value, index) =&gt; {     const movieMatch = movie.id === value.movie_id     if (movieMatch) {       acc+=value.rating       count++     }     if (index === movingWithRatings.length - 1) {       acc = acc\/count     }     return acc   }, 0) }  const isSubString = (str1, str2) =&gt; {   str1 = toLower(str1.split(\" \").join(\"\"))   str2 = toLower(str2.split(\" \").join(\"\"))   if (str1.length &gt; str2.length) {     return str1.startWith(str2)   } else {     return str2.startWith(str1)   } }  const moviesList = getMovies() const movingWithRatings = getRatings(); function queryMovies({ search, sort, minAvgRating }) {   let filteredMovies = movingWithRatings.filter(movie =&gt; getAvrgRating(movie, movingWithRatings) &gt;= minAvgRating);   filteredMovies = filteredMovies.map(movie =&gt; moviesList.filter(listItem =&gt; listItem.id === movie.movie_id).pop())   filteredMovies = filteredMovies.filter(movie =&gt; isSubString(toLower(movie.name), toLower(search)))   filteredMovies = filteredMovies.sort((a, b) =&gt; {     const isDescending = sort[0] === '-' ? true : false     let sortCopy = isDescending ? sort.slice(1) : sort     const value1 = a[sortCopy]     const value2 = b[sortCopy]     if (isDescending) {       return value1 &gt; value2 ? -1 : 1     }else {       return value1 &lt; value2 ? -1 : 1     }   })   filteredMovies = filteredMovies.map(movie =&gt; ({     ...movie,     avgRating: movingWithRatings.filter(ratedMovie =&gt; ratedMovie.movie_id === movie.id)[0].rating   }))   return filteredMovies } <\/code><\/pre>\n<p>4. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0432\u0441\u0435 <code>\u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/code> \u0438 <code>\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438<\/code> \u043f\u043e URL-\u0430\u0434\u0440\u0435\u0441\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u043e\u0442\u043d\u0435\u0441\u0438\u0442\u0435 \u0432\u0441\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043d\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.  <\/p>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/devAbhijeet\/cure-fit-interview-challenge\/tree\/master\/\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/a><\/p>\n<pre><code class=\"javascript\">\/\/service.js const POSTS_URL = `https:\/\/jsonplaceholder.typicode.com\/posts`; const COMMENTS_URL = `https:\/\/jsonplaceholder.typicode.com\/comments`;  export const fetchAllPosts = () =&gt; {   return fetch(POSTS_URL).then(res =&gt; res.json()); };  export const fetchAllComments = () =&gt; {   return fetch(COMMENTS_URL).then(res =&gt; res.json()); };   import { fetchAllPosts, fetchAllComments } from \".\/service\";    const fetchData = async () =&gt; {   const [posts, comments] = await Promise.all([     fetchAllPosts(),     fetchAllComments()   ]);    const grabAllCommentsForPost = postId =&gt;     comments.filter(comment =&gt; comment.postId === postId);    const mappedPostWithComment = posts.reduce((acc, post) =&gt; {     const allComments = grabAllCommentsForPost(post.id);     acc[post.id] = allComments;     return acc;   }, {});    console.log(\"mappedPostWithComment \", mappedPostWithComment); };  fetchData(); <\/code><\/pre>\n<p>5. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 <code>getHashCode<\/code> \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 string. \u041c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">let s1 = \"sample\"  if (!String.prototype.getHashCode) {   String.prototype.getHashCode = function(){     console.log('String instance ', this)     return this   } } <\/code><\/pre>\n<p> 6. \u041a\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439?<\/p>\n<pre><code class=\"javascript\">    1+true     true+true     \u20181\u2019+true     \u20182\u2019 &gt; \u20193\u2019     \u2018two\u2019&gt;\u2019three\u2019 <\/code><\/pre>\n<p> \u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">2 2 1true false true<\/code><\/pre>\n<p>7. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u044b <code>bind<\/code> \u0438 <code>reduce<\/code>.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/bind if (!Function.prototype.bind) {   Function.prototype.bind = function(...arg){     const func = this     const context = arg[0]     const params = arg.slice(1)     return function(...innerParam) {       func.apply(context, [...params, ...innerParam])     }   } }  \/\/reduce Array.prototype.reduce = function(func, initState) {   const arr = this   const callback = func   let init = initState    arr.forEach(function(value, index){       init=callback(init, value)   })   return init } <\/code><\/pre>\n<p>8. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e debounce<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const debounce = function(func, interval) {   let timerId;   return function(e){     clearTimeout(timerId)     timerId = setTimeout(function(){       func.apply()     }, interval)   } } debounce(apiCall, 3000) <\/code><\/pre>\n<p>9. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e throttle<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">const throttle = (callback, interval) =&gt; {   let timerId;   let allowEvents = true;    return function() {     let context = this;     let args = arguments;      if (allowEvents) {       callback.apply(context, args)       allowEvents = false;       timerId = setTimeOut(function(){         allowEvents = true       }, interval)     }   } } <\/code><\/pre>\n<p>10. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f API. \u0412\u044b\u0437\u043e\u0432 API \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b. \u042d\u0442\u043e API \u0444\u043e\u043d\u0434\u043e\u0432\u043e\u0433\u043e \u0440\u044b\u043d\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043a\u043e\u0442\u0438\u0440\u043e\u0432\u043a\u0430\u0445. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u0435 \u0438\u0445 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435.<\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u043a\u043e\u0434 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 setInterval, \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430 throttle \u0438 \u0444\u043b\u0430\u0433\u043e\u0432 setInterval=&gt;Endpoint=&gt;Render  \/\/\u0441 \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \/\/Endpoint=&gt;Render=&gt;setTimeout=&gt;Endpoint=&gt;Render=&gt;SetTimeout...<\/code><\/pre>\n<p>11. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0432 ES5.<\/p>\n<pre><code class=\"javascript\">class Parent(name){   constructor(name) {     this.name=name   }    getName(){return this.name} }  class Children extends Parent {   constructor(props){     super(props)   } }<\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">function Parent(name) {   this.name = name }  Parent.prototype.getName = function() {   return this.name }  function Children(name){   Parent.call(this, name) }  Children.prototype = new Parent() <\/code><\/pre>\n<p>12. \u0427\u0442\u043e \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434?<\/p>\n<pre><code class=\"javascript\">\/\/Q.1 var x = 1; var y = x;  x = 0; console.log(x, y);  \/\/Q.2 var x = [1]; var y = x;  x = []; console.log(x,y);  \/\/Q.3 function Abc() { console.log(this); }; Abc() new Abc();  \/\/Q.4 var x = 1; var obj = {   x: 2,   getX: function () {     return console.log(this.x);   } };  obj.getX() let a = obj.getX console.log(a)  \/\/Q.5 \/\/\u041a\u0430\u043a \u0432\u044b\u0432\u0435\u0441\u0442\u0438 2 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 a \u0432 \u043a\u043e\u0434\u0435 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430?  \/\/Q.6 console.log(\"A\"); setTimeout(() =&gt; console.log(\"B\"), 0); setTimeout(() =&gt; console.log(\"C\"), 0); console.log(\"D\");  \/\/Q.7 setTimeout(function() {   console.log(\"A\"); }, 0); Promise.resolve().then(function() {   console.log(\"B\"); }).then(function() {   console.log(\"C\"); });  console.log(\"D\");  \/\/Q.8 let obj1 = {   a:1,   b:2 }  function mutate(obj) {   obj = {a:4, c:6} }  console.log(obj1) mutate(obj1) console.log(obj1) <\/code><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/A.1 0 1  \/\/A.2 [] [1]  \/\/A.3 \u0411\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442 window  \/\/A.4 \u0411\u0443\u0434\u0443\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 2 \u0438 1  \/\/A.5 a.call(obj);  \/\/A.6 A, D, B , C  \/\/A.7 D, B, C, A  \/\/A.8 { a: 1, b: 2 } { a: 1, b: 2 }<\/code><\/pre>\n<p> 13. \u0415\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b. \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/p>\n<pre><code class=\"javascript\">const list = [1,2,3,4,5,6,7,8] const filteredArray = list.filter(between(3, 6)) \/\/ [4,5]<\/code><\/pre>\n<p> \u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"javascript\">function between(start, end) {   return function (value,index) {     return value&gt;start &amp;&amp; value&lt;end   } }<\/code><\/pre>\n<h3>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b<\/h3>\n<p>1. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"javascript\">A := 1 B := A*2 + 2 C := B*2 + 3 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435...<\/code><\/pre>\n<p>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435<\/p>\n<p><\/br><\/br><\/p>\n<\/hr>\n<\/hr>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-309371","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=309371"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309371\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=309371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=309371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}