Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

simon.kan1 avatar simon.kan1 9 Точки

06. Format the Text DOM Introduction

Здравейте, тази зад ми дава 40/100 , на зеро тестовете минава, и не мога да открия от какво, моят код:

https://pastebin.com/FUCAJeEF

https://judge.softuni.bg/Contests/Compete/Index/2761#5

06.Format the Text

Create functionality that gets text from textarea, formats the given text - you need to find out how many sentences there are in the text, simply split the whole text by '.'
Also, every sentence must have at least 1 character.

Generate HTML paragraphs as a string (Use interpolation string to create paragraph element: `<p> {text} </p>`) and append it to the div with an id = "output".

When the [Format] button is clicked, get the text inside the textarea with an id="input" and format it. The formatting is done as follows:

  • Create a new paragraph element which holds no more than 3 sentences from the given input.
  • Hint: Use interpolation string to create paragraph element. (`<p> {text} </p>`)
  • If the given input contains less or 3 sentences, you need to create only 1 paragraph, fill it with these sentences and append this paragraph to the div with an id="output".

Otherwise, when you have more than 3 sentences, create enough paragraphs to get all sentences from the textarea.

Just remember to restrict the sentences in each paragraph to 3.

Example:

  • If the input textarea contains 2 sentences, create only 1 paragraph with these 2 sentences

 

  • If the input textarea contains 7 sentences, create 3 paragraphs
    - The first paragraph must contain the first 3 sentences
    - The second paragraph must contain the other three sentences of the whole text
    - The third paragraph will contain only the last sentence

Output

Input

Output

JavaScript, often abbreviated as JS, is a high-level, interpreted programming language. It is a language which is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm.

<p>JavaScript, often abbreviated as JS, is a high-level, interpreted programming language. It is a language which is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm.</p>

JavaScript, often abbreviated as JS, is a high-level, interpreted programming language. It is a language which is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm. Alongside HTML and CSS, JavaScript is one of the three core technologies of the World Wide Web. JavaScript enables interactive web pages and thus is an essential part of web applications. The vast majority of websites use it, and all major web browsers have a dedicated JavaScript engine to execute it. As a multi-paradigm language, JavaScript supports event-driven, functional, and imperative (including object-oriented and prototype-based) programming styles. It has an API for working with text, arrays, dates, regular expressions, and basic manipulation of the DOM, but the language itself does not include any I/O, such as networking, storage, or graphics facilities, relying for these upon the host environment in which it is embedded.

<p>JavaScript, often abbreviated as JS, is a high-level, interpreted programming language.It is a

language which is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm.Alongside

HTML and CSS, JavaScript is one of the three core technologies of the World Wide Web.</p>
<p>JavaScript enables

interactive web pages and thus is an essential part of web applications.The vast majority of websites use it,

and all major web browsers have a dedicated JavaScript engine to execute it.As a multi-paradigm language,

JavaScript supports event-driven, functional, and imperative (including object-oriented and prototype-based)

programming styles.</p>

<p>It has an API for working with text, arrays, dates, regular expressions, and basic

manipulation of the DOM, but the language itself does not include any I/O, such as networking, storage, or

graphics facilities, relying for these upon the host environment in which it is embedded.</p>

Тагове:
1
JavaScript Advanced
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.